aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx
diff options
context:
space:
mode:
authorKalle Valo <kalle.valo@nokia.com>2009-06-12 07:17:39 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 14:57:50 -0400
commit80301cdcfe44e3533175be23d7d52a9fc8c3fdb0 (patch)
tree624d018b822016a8f83d49588012519a4e9a4d16 /drivers/net/wireless/wl12xx
parent1e6f172fccbf1194bad4b2aeae437ec3189a3f08 (diff)
wl1251: use wl1251 prefix everywhere
Last we can change all code prefixes from wl12xx/WL12XX to wl1251/WL1251. Signed-off-by: Kalle Valo <kalle.valo@nokia.com> Reviewed-by: Vidhya Govindan <vidhya.govindan@nokia.com> Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx')
-rw-r--r--drivers/net/wireless/wl12xx/wl1251.h102
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_acx.c229
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_acx.h76
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_boot.c106
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_boot.h10
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_cmd.c133
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_cmd.h78
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_debugfs.c48
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_debugfs.h14
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_event.c46
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_event.h12
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_init.c72
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_init.h24
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_main.c477
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_netlink.c400
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_netlink.h12
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_ops.c190
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_ops.h4
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_ps.c56
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_ps.h14
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_rx.c52
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_rx.h20
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_spi.c107
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_spi.h44
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_tx.c70
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_tx.h6
26 files changed, 1203 insertions, 1199 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1251.h b/drivers/net/wireless/wl12xx/wl1251.h
index c673cdb42d6..665aca02bea 100644
--- a/drivers/net/wireless/wl12xx/wl1251.h
+++ b/drivers/net/wireless/wl12xx/wl1251.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (c) 1998-2007 Texas Instruments Incorporated 4 * Copyright (c) 1998-2007 Texas Instruments Incorporated
5 * Copyright (C) 2008-2009 Nokia Corporation 5 * Copyright (C) 2008-2009 Nokia Corporation
@@ -22,15 +22,15 @@
22 * 22 *
23 */ 23 */
24 24
25#ifndef __WL12XX_H__ 25#ifndef __WL1251_H__
26#define __WL12XX_H__ 26#define __WL1251_H__
27 27
28#include <linux/mutex.h> 28#include <linux/mutex.h>
29#include <linux/list.h> 29#include <linux/list.h>
30#include <linux/bitops.h> 30#include <linux/bitops.h>
31#include <net/mac80211.h> 31#include <net/mac80211.h>
32 32
33#define DRIVER_NAME "wl12xx" 33#define DRIVER_NAME "wl1251"
34#define DRIVER_PREFIX DRIVER_NAME ": " 34#define DRIVER_PREFIX DRIVER_NAME ": "
35 35
36enum { 36enum {
@@ -56,25 +56,25 @@ enum {
56 56
57#define DEBUG_DUMP_LIMIT 1024 57#define DEBUG_DUMP_LIMIT 1024
58 58
59#define wl12xx_error(fmt, arg...) \ 59#define wl1251_error(fmt, arg...) \
60 printk(KERN_ERR DRIVER_PREFIX "ERROR " fmt "\n", ##arg) 60 printk(KERN_ERR DRIVER_PREFIX "ERROR " fmt "\n", ##arg)
61 61
62#define wl12xx_warning(fmt, arg...) \ 62#define wl1251_warning(fmt, arg...) \
63 printk(KERN_WARNING DRIVER_PREFIX "WARNING " fmt "\n", ##arg) 63 printk(KERN_WARNING DRIVER_PREFIX "WARNING " fmt "\n", ##arg)
64 64
65#define wl12xx_notice(fmt, arg...) \ 65#define wl1251_notice(fmt, arg...) \
66 printk(KERN_INFO DRIVER_PREFIX fmt "\n", ##arg) 66 printk(KERN_INFO DRIVER_PREFIX fmt "\n", ##arg)
67 67
68#define wl12xx_info(fmt, arg...) \ 68#define wl1251_info(fmt, arg...) \
69 printk(KERN_DEBUG DRIVER_PREFIX fmt "\n", ##arg) 69 printk(KERN_DEBUG DRIVER_PREFIX fmt "\n", ##arg)
70 70
71#define wl12xx_debug(level, fmt, arg...) \ 71#define wl1251_debug(level, fmt, arg...) \
72 do { \ 72 do { \
73 if (level & DEBUG_LEVEL) \ 73 if (level & DEBUG_LEVEL) \
74 printk(KERN_DEBUG DRIVER_PREFIX fmt "\n", ##arg); \ 74 printk(KERN_DEBUG DRIVER_PREFIX fmt "\n", ##arg); \
75 } while (0) 75 } while (0)
76 76
77#define wl12xx_dump(level, prefix, buf, len) \ 77#define wl1251_dump(level, prefix, buf, len) \
78 do { \ 78 do { \
79 if (level & DEBUG_LEVEL) \ 79 if (level & DEBUG_LEVEL) \
80 print_hex_dump(KERN_DEBUG, DRIVER_PREFIX prefix, \ 80 print_hex_dump(KERN_DEBUG, DRIVER_PREFIX prefix, \
@@ -84,7 +84,7 @@ enum {
84 0); \ 84 0); \
85 } while (0) 85 } while (0)
86 86
87#define wl12xx_dump_ascii(level, prefix, buf, len) \ 87#define wl1251_dump_ascii(level, prefix, buf, len) \
88 do { \ 88 do { \
89 if (level & DEBUG_LEVEL) \ 89 if (level & DEBUG_LEVEL) \
90 print_hex_dump(KERN_DEBUG, DRIVER_PREFIX prefix, \ 90 print_hex_dump(KERN_DEBUG, DRIVER_PREFIX prefix, \
@@ -94,10 +94,10 @@ enum {
94 true); \ 94 true); \
95 } while (0) 95 } while (0)
96 96
97#define WL12XX_DEFAULT_RX_CONFIG (CFG_UNI_FILTER_EN | \ 97#define WL1251_DEFAULT_RX_CONFIG (CFG_UNI_FILTER_EN | \
98 CFG_BSSID_FILTER_EN) 98 CFG_BSSID_FILTER_EN)
99 99
100#define WL12XX_DEFAULT_RX_FILTER (CFG_RX_PRSP_EN | \ 100#define WL1251_DEFAULT_RX_FILTER (CFG_RX_PRSP_EN | \
101 CFG_RX_MGMT_EN | \ 101 CFG_RX_MGMT_EN | \
102 CFG_RX_DATA_EN | \ 102 CFG_RX_DATA_EN | \
103 CFG_RX_CTL_EN | \ 103 CFG_RX_CTL_EN | \
@@ -105,7 +105,7 @@ enum {
105 CFG_RX_AUTH_EN | \ 105 CFG_RX_AUTH_EN | \
106 CFG_RX_ASSOC_EN) 106 CFG_RX_ASSOC_EN)
107 107
108#define WL12XX_BUSY_WORD_LEN 8 108#define WL1251_BUSY_WORD_LEN 8
109 109
110struct boot_attr { 110struct boot_attr {
111 u32 radio_type; 111 u32 radio_type;
@@ -117,13 +117,13 @@ struct boot_attr {
117 u32 bugfix; 117 u32 bugfix;
118}; 118};
119 119
120enum wl12xx_state { 120enum wl1251_state {
121 WL12XX_STATE_OFF, 121 WL1251_STATE_OFF,
122 WL12XX_STATE_ON, 122 WL1251_STATE_ON,
123 WL12XX_STATE_PLT, 123 WL1251_STATE_PLT,
124}; 124};
125 125
126enum wl12xx_partition_type { 126enum wl1251_partition_type {
127 PART_DOWN, 127 PART_DOWN,
128 PART_WORK, 128 PART_WORK,
129 PART_DRPW, 129 PART_DRPW,
@@ -131,20 +131,20 @@ enum wl12xx_partition_type {
131 PART_TABLE_LEN 131 PART_TABLE_LEN
132}; 132};
133 133
134struct wl12xx_partition { 134struct wl1251_partition {
135 u32 size; 135 u32 size;
136 u32 start; 136 u32 start;
137}; 137};
138 138
139struct wl12xx_partition_set { 139struct wl1251_partition_set {
140 struct wl12xx_partition mem; 140 struct wl1251_partition mem;
141 struct wl12xx_partition reg; 141 struct wl1251_partition reg;
142}; 142};
143 143
144struct wl12xx; 144struct wl1251;
145 145
146/* FIXME: I'm not sure about this structure name */ 146/* FIXME: I'm not sure about this structure name */
147struct wl12xx_chip { 147struct wl1251_chip {
148 u32 id; 148 u32 id;
149 149
150 const char *fw_filename; 150 const char *fw_filename;
@@ -156,23 +156,23 @@ struct wl12xx_chip {
156 int intr_cmd_complete; 156 int intr_cmd_complete;
157 int intr_init_complete; 157 int intr_init_complete;
158 158
159 int (*op_upload_fw)(struct wl12xx *wl); 159 int (*op_upload_fw)(struct wl1251 *wl);
160 int (*op_upload_nvs)(struct wl12xx *wl); 160 int (*op_upload_nvs)(struct wl1251 *wl);
161 int (*op_boot)(struct wl12xx *wl); 161 int (*op_boot)(struct wl1251 *wl);
162 void (*op_set_ecpu_ctrl)(struct wl12xx *wl, u32 flag); 162 void (*op_set_ecpu_ctrl)(struct wl1251 *wl, u32 flag);
163 void (*op_target_enable_interrupts)(struct wl12xx *wl); 163 void (*op_target_enable_interrupts)(struct wl1251 *wl);
164 int (*op_hw_init)(struct wl12xx *wl); 164 int (*op_hw_init)(struct wl1251 *wl);
165 int (*op_plt_init)(struct wl12xx *wl); 165 int (*op_plt_init)(struct wl1251 *wl);
166 void (*op_tx_flush)(struct wl12xx *wl); 166 void (*op_tx_flush)(struct wl1251 *wl);
167 void (*op_fw_version)(struct wl12xx *wl); 167 void (*op_fw_version)(struct wl1251 *wl);
168 int (*op_cmd_join)(struct wl12xx *wl, u8 bss_type, u8 dtim_interval, 168 int (*op_cmd_join)(struct wl1251 *wl, u8 bss_type, u8 dtim_interval,
169 u16 beacon_interval, u8 wait); 169 u16 beacon_interval, u8 wait);
170 170
171 struct wl12xx_partition_set *p_table; 171 struct wl1251_partition_set *p_table;
172 enum wl12xx_acx_int_reg *acx_reg_table; 172 enum wl12xx_acx_int_reg *acx_reg_table;
173}; 173};
174 174
175struct wl12xx_stats { 175struct wl1251_stats {
176 struct acx_statistics *fw_stats; 176 struct acx_statistics *fw_stats;
177 unsigned long fw_stats_update; 177 unsigned long fw_stats_update;
178 178
@@ -180,7 +180,7 @@ struct wl12xx_stats {
180 unsigned int excessive_retries; 180 unsigned int excessive_retries;
181}; 181};
182 182
183struct wl12xx_debugfs { 183struct wl1251_debugfs {
184 struct dentry *rootdir; 184 struct dentry *rootdir;
185 struct dentry *fw_statistics; 185 struct dentry *fw_statistics;
186 186
@@ -281,7 +281,7 @@ struct wl12xx_debugfs {
281 struct dentry *excessive_retries; 281 struct dentry *excessive_retries;
282}; 282};
283 283
284struct wl12xx { 284struct wl1251 {
285 struct ieee80211_hw *hw; 285 struct ieee80211_hw *hw;
286 bool mac80211_registered; 286 bool mac80211_registered;
287 287
@@ -290,7 +290,7 @@ struct wl12xx {
290 void (*set_power)(bool enable); 290 void (*set_power)(bool enable);
291 int irq; 291 int irq;
292 292
293 enum wl12xx_state state; 293 enum wl1251_state state;
294 struct mutex mutex; 294 struct mutex mutex;
295 295
296 int physical_mem_addr; 296 int physical_mem_addr;
@@ -298,7 +298,7 @@ struct wl12xx {
298 int virtual_mem_addr; 298 int virtual_mem_addr;
299 int virtual_reg_addr; 299 int virtual_reg_addr;
300 300
301 struct wl12xx_chip chip; 301 struct wl1251_chip chip;
302 302
303 int cmd_box_addr; 303 int cmd_box_addr;
304 int event_box_addr; 304 int event_box_addr;
@@ -385,31 +385,31 @@ struct wl12xx {
385 /* in dBm */ 385 /* in dBm */
386 int power_level; 386 int power_level;
387 387
388 struct wl12xx_stats stats; 388 struct wl1251_stats stats;
389 struct wl12xx_debugfs debugfs; 389 struct wl1251_debugfs debugfs;
390 390
391 u32 buffer_32; 391 u32 buffer_32;
392 u32 buffer_cmd; 392 u32 buffer_cmd;
393 u8 buffer_busyword[WL12XX_BUSY_WORD_LEN]; 393 u8 buffer_busyword[WL1251_BUSY_WORD_LEN];
394 struct wl12xx_rx_descriptor *rx_descriptor; 394 struct wl1251_rx_descriptor *rx_descriptor;
395}; 395};
396 396
397int wl12xx_plt_start(struct wl12xx *wl); 397int wl1251_plt_start(struct wl1251 *wl);
398int wl12xx_plt_stop(struct wl12xx *wl); 398int wl1251_plt_stop(struct wl1251 *wl);
399 399
400#define DEFAULT_HW_GEN_MODULATION_TYPE CCK_LONG /* Long Preamble */ 400#define DEFAULT_HW_GEN_MODULATION_TYPE CCK_LONG /* Long Preamble */
401#define DEFAULT_HW_GEN_TX_RATE RATE_2MBPS 401#define DEFAULT_HW_GEN_TX_RATE RATE_2MBPS
402#define JOIN_TIMEOUT 5000 /* 5000 milliseconds to join */ 402#define JOIN_TIMEOUT 5000 /* 5000 milliseconds to join */
403 403
404#define WL12XX_DEFAULT_POWER_LEVEL 20 404#define WL1251_DEFAULT_POWER_LEVEL 20
405 405
406#define WL12XX_TX_QUEUE_MAX_LENGTH 20 406#define WL1251_TX_QUEUE_MAX_LENGTH 20
407 407
408/* Different chips need different sleep times after power on. WL1271 needs 408/* Different chips need different sleep times after power on. WL1271 needs
409 * 200ms, WL1251 needs only 10ms. By default we use 200ms, but as soon as we 409 * 200ms, WL1251 needs only 10ms. By default we use 200ms, but as soon as we
410 * know the chip ID, we change the sleep value in the wl12xx chip structure, 410 * know the chip ID, we change the sleep value in the wl1251 chip structure,
411 * so in subsequent power ons, we don't waste more time then needed. */ 411 * so in subsequent power ons, we don't waste more time then needed. */
412#define WL12XX_DEFAULT_POWER_ON_SLEEP 200 412#define WL1251_DEFAULT_POWER_ON_SLEEP 200
413 413
414#define CHIP_ID_1251_PG10 (0x7010101) 414#define CHIP_ID_1251_PG10 (0x7010101)
415#define CHIP_ID_1251_PG11 (0x7020101) 415#define CHIP_ID_1251_PG11 (0x7020101)
diff --git a/drivers/net/wireless/wl12xx/wl1251_acx.c b/drivers/net/wireless/wl12xx/wl1251_acx.c
index 1a840fa16db..5a8d21c3192 100644
--- a/drivers/net/wireless/wl12xx/wl1251_acx.c
+++ b/drivers/net/wireless/wl12xx/wl1251_acx.c
@@ -5,18 +5,17 @@
5#include <linux/spi/spi.h> 5#include <linux/spi/spi.h>
6 6
7#include "wl1251.h" 7#include "wl1251.h"
8#include "wl12xx_80211.h"
9#include "reg.h" 8#include "reg.h"
10#include "wl1251_spi.h" 9#include "wl1251_spi.h"
11#include "wl1251_ps.h" 10#include "wl1251_ps.h"
12 11
13int wl12xx_acx_frame_rates(struct wl12xx *wl, u8 ctrl_rate, u8 ctrl_mod, 12int wl1251_acx_frame_rates(struct wl1251 *wl, u8 ctrl_rate, u8 ctrl_mod,
14 u8 mgt_rate, u8 mgt_mod) 13 u8 mgt_rate, u8 mgt_mod)
15{ 14{
16 struct acx_fw_gen_frame_rates *rates; 15 struct acx_fw_gen_frame_rates *rates;
17 int ret; 16 int ret;
18 17
19 wl12xx_debug(DEBUG_ACX, "acx frame rates"); 18 wl1251_debug(DEBUG_ACX, "acx frame rates");
20 19
21 rates = kzalloc(sizeof(*rates), GFP_KERNEL); 20 rates = kzalloc(sizeof(*rates), GFP_KERNEL);
22 if (!rates) { 21 if (!rates) {
@@ -29,10 +28,10 @@ int wl12xx_acx_frame_rates(struct wl12xx *wl, u8 ctrl_rate, u8 ctrl_mod,
29 rates->tx_mgt_frame_rate = mgt_rate; 28 rates->tx_mgt_frame_rate = mgt_rate;
30 rates->tx_mgt_frame_mod = mgt_mod; 29 rates->tx_mgt_frame_mod = mgt_mod;
31 30
32 ret = wl12xx_cmd_configure(wl, ACX_FW_GEN_FRAME_RATES, 31 ret = wl1251_cmd_configure(wl, ACX_FW_GEN_FRAME_RATES,
33 rates, sizeof(*rates)); 32 rates, sizeof(*rates));
34 if (ret < 0) { 33 if (ret < 0) {
35 wl12xx_error("Failed to set FW rates and modulation"); 34 wl1251_error("Failed to set FW rates and modulation");
36 goto out; 35 goto out;
37 } 36 }
38 37
@@ -42,12 +41,12 @@ out:
42} 41}
43 42
44 43
45int wl12xx_acx_station_id(struct wl12xx *wl) 44int wl1251_acx_station_id(struct wl1251 *wl)
46{ 45{
47 struct acx_dot11_station_id *mac; 46 struct acx_dot11_station_id *mac;
48 int ret, i; 47 int ret, i;
49 48
50 wl12xx_debug(DEBUG_ACX, "acx dot11_station_id"); 49 wl1251_debug(DEBUG_ACX, "acx dot11_station_id");
51 50
52 mac = kzalloc(sizeof(*mac), GFP_KERNEL); 51 mac = kzalloc(sizeof(*mac), GFP_KERNEL);
53 if (!mac) { 52 if (!mac) {
@@ -58,7 +57,7 @@ int wl12xx_acx_station_id(struct wl12xx *wl)
58 for (i = 0; i < ETH_ALEN; i++) 57 for (i = 0; i < ETH_ALEN; i++)
59 mac->mac[i] = wl->mac_addr[ETH_ALEN - 1 - i]; 58 mac->mac[i] = wl->mac_addr[ETH_ALEN - 1 - i];
60 59
61 ret = wl12xx_cmd_configure(wl, DOT11_STATION_ID, mac, sizeof(*mac)); 60 ret = wl1251_cmd_configure(wl, DOT11_STATION_ID, mac, sizeof(*mac));
62 if (ret < 0) 61 if (ret < 0)
63 goto out; 62 goto out;
64 63
@@ -67,12 +66,12 @@ out:
67 return ret; 66 return ret;
68} 67}
69 68
70int wl12xx_acx_default_key(struct wl12xx *wl, u8 key_id) 69int wl1251_acx_default_key(struct wl1251 *wl, u8 key_id)
71{ 70{
72 struct acx_dot11_default_key *default_key; 71 struct acx_dot11_default_key *default_key;
73 int ret; 72 int ret;
74 73
75 wl12xx_debug(DEBUG_ACX, "acx dot11_default_key (%d)", key_id); 74 wl1251_debug(DEBUG_ACX, "acx dot11_default_key (%d)", key_id);
76 75
77 default_key = kzalloc(sizeof(*default_key), GFP_KERNEL); 76 default_key = kzalloc(sizeof(*default_key), GFP_KERNEL);
78 if (!default_key) { 77 if (!default_key) {
@@ -82,10 +81,10 @@ int wl12xx_acx_default_key(struct wl12xx *wl, u8 key_id)
82 81
83 default_key->id = key_id; 82 default_key->id = key_id;
84 83
85 ret = wl12xx_cmd_configure(wl, DOT11_DEFAULT_KEY, 84 ret = wl1251_cmd_configure(wl, DOT11_DEFAULT_KEY,
86 default_key, sizeof(*default_key)); 85 default_key, sizeof(*default_key));
87 if (ret < 0) { 86 if (ret < 0) {
88 wl12xx_error("Couldnt set default key"); 87 wl1251_error("Couldnt set default key");
89 goto out; 88 goto out;
90 } 89 }
91 90
@@ -96,13 +95,13 @@ out:
96 return ret; 95 return ret;
97} 96}
98 97
99int wl12xx_acx_wake_up_conditions(struct wl12xx *wl, u8 wake_up_event, 98int wl1251_acx_wake_up_conditions(struct wl1251 *wl, u8 wake_up_event,
100 u8 listen_interval) 99 u8 listen_interval)
101{ 100{
102 struct acx_wake_up_condition *wake_up; 101 struct acx_wake_up_condition *wake_up;
103 int ret; 102 int ret;
104 103
105 wl12xx_debug(DEBUG_ACX, "acx wake up conditions"); 104 wl1251_debug(DEBUG_ACX, "acx wake up conditions");
106 105
107 wake_up = kzalloc(sizeof(*wake_up), GFP_KERNEL); 106 wake_up = kzalloc(sizeof(*wake_up), GFP_KERNEL);
108 if (!wake_up) { 107 if (!wake_up) {
@@ -113,10 +112,10 @@ int wl12xx_acx_wake_up_conditions(struct wl12xx *wl, u8 wake_up_event,
113 wake_up->wake_up_event = wake_up_event; 112 wake_up->wake_up_event = wake_up_event;
114 wake_up->listen_interval = listen_interval; 113 wake_up->listen_interval = listen_interval;
115 114
116 ret = wl12xx_cmd_configure(wl, ACX_WAKE_UP_CONDITIONS, 115 ret = wl1251_cmd_configure(wl, ACX_WAKE_UP_CONDITIONS,
117 wake_up, sizeof(*wake_up)); 116 wake_up, sizeof(*wake_up));
118 if (ret < 0) { 117 if (ret < 0) {
119 wl12xx_warning("could not set wake up conditions: %d", ret); 118 wl1251_warning("could not set wake up conditions: %d", ret);
120 goto out; 119 goto out;
121 } 120 }
122 121
@@ -125,12 +124,12 @@ out:
125 return ret; 124 return ret;
126} 125}
127 126
128int wl12xx_acx_sleep_auth(struct wl12xx *wl, u8 sleep_auth) 127int wl1251_acx_sleep_auth(struct wl1251 *wl, u8 sleep_auth)
129{ 128{
130 struct acx_sleep_auth *auth; 129 struct acx_sleep_auth *auth;
131 int ret; 130 int ret;
132 131
133 wl12xx_debug(DEBUG_ACX, "acx sleep auth"); 132 wl1251_debug(DEBUG_ACX, "acx sleep auth");
134 133
135 auth = kzalloc(sizeof(*auth), GFP_KERNEL); 134 auth = kzalloc(sizeof(*auth), GFP_KERNEL);
136 if (!auth) { 135 if (!auth) {
@@ -140,7 +139,7 @@ int wl12xx_acx_sleep_auth(struct wl12xx *wl, u8 sleep_auth)
140 139
141 auth->sleep_auth = sleep_auth; 140 auth->sleep_auth = sleep_auth;
142 141
143 ret = wl12xx_cmd_configure(wl, ACX_SLEEP_AUTH, auth, sizeof(*auth)); 142 ret = wl1251_cmd_configure(wl, ACX_SLEEP_AUTH, auth, sizeof(*auth));
144 if (ret < 0) 143 if (ret < 0)
145 return ret; 144 return ret;
146 145
@@ -149,12 +148,12 @@ out:
149 return ret; 148 return ret;
150} 149}
151 150
152int wl12xx_acx_fw_version(struct wl12xx *wl, char *buf, size_t len) 151int wl1251_acx_fw_version(struct wl1251 *wl, char *buf, size_t len)
153{ 152{
154 struct acx_revision *rev; 153 struct acx_revision *rev;
155 int ret; 154 int ret;
156 155
157 wl12xx_debug(DEBUG_ACX, "acx fw rev"); 156 wl1251_debug(DEBUG_ACX, "acx fw rev");
158 157
159 rev = kzalloc(sizeof(*rev), GFP_KERNEL); 158 rev = kzalloc(sizeof(*rev), GFP_KERNEL);
160 if (!rev) { 159 if (!rev) {
@@ -162,9 +161,9 @@ int wl12xx_acx_fw_version(struct wl12xx *wl, char *buf, size_t len)
162 goto out; 161 goto out;
163 } 162 }
164 163
165 ret = wl12xx_cmd_interrogate(wl, ACX_FW_REV, rev, sizeof(*rev)); 164 ret = wl1251_cmd_interrogate(wl, ACX_FW_REV, rev, sizeof(*rev));
166 if (ret < 0) { 165 if (ret < 0) {
167 wl12xx_warning("ACX_FW_REV interrogate failed"); 166 wl1251_warning("ACX_FW_REV interrogate failed");
168 goto out; 167 goto out;
169 } 168 }
170 169
@@ -183,12 +182,12 @@ out:
183 return ret; 182 return ret;
184} 183}
185 184
186int wl12xx_acx_tx_power(struct wl12xx *wl, int power) 185int wl1251_acx_tx_power(struct wl1251 *wl, int power)
187{ 186{
188 struct acx_current_tx_power *acx; 187 struct acx_current_tx_power *acx;
189 int ret; 188 int ret;
190 189
191 wl12xx_debug(DEBUG_ACX, "acx dot11_cur_tx_pwr"); 190 wl1251_debug(DEBUG_ACX, "acx dot11_cur_tx_pwr");
192 191
193 if (power < 0 || power > 25) 192 if (power < 0 || power > 25)
194 return -EINVAL; 193 return -EINVAL;
@@ -201,9 +200,9 @@ int wl12xx_acx_tx_power(struct wl12xx *wl, int power)
201 200
202 acx->current_tx_power = power * 10; 201 acx->current_tx_power = power * 10;
203 202
204 ret = wl12xx_cmd_configure(wl, DOT11_CUR_TX_PWR, acx, sizeof(*acx)); 203 ret = wl1251_cmd_configure(wl, DOT11_CUR_TX_PWR, acx, sizeof(*acx));
205 if (ret < 0) { 204 if (ret < 0) {
206 wl12xx_warning("configure of tx power failed: %d", ret); 205 wl1251_warning("configure of tx power failed: %d", ret);
207 goto out; 206 goto out;
208 } 207 }
209 208
@@ -212,12 +211,12 @@ out:
212 return ret; 211 return ret;
213} 212}
214 213
215int wl12xx_acx_feature_cfg(struct wl12xx *wl) 214int wl1251_acx_feature_cfg(struct wl1251 *wl)
216{ 215{
217 struct acx_feature_config *feature; 216 struct acx_feature_config *feature;
218 int ret; 217 int ret;
219 218
220 wl12xx_debug(DEBUG_ACX, "acx feature cfg"); 219 wl1251_debug(DEBUG_ACX, "acx feature cfg");
221 220
222 feature = kzalloc(sizeof(*feature), GFP_KERNEL); 221 feature = kzalloc(sizeof(*feature), GFP_KERNEL);
223 if (!feature) { 222 if (!feature) {
@@ -229,10 +228,10 @@ int wl12xx_acx_feature_cfg(struct wl12xx *wl)
229 feature->data_flow_options = 0; 228 feature->data_flow_options = 0;
230 feature->options = 0; 229 feature->options = 0;
231 230
232 ret = wl12xx_cmd_configure(wl, ACX_FEATURE_CFG, 231 ret = wl1251_cmd_configure(wl, ACX_FEATURE_CFG,
233 feature, sizeof(*feature)); 232 feature, sizeof(*feature));
234 if (ret < 0) { 233 if (ret < 0) {
235 wl12xx_error("Couldnt set HW encryption"); 234 wl1251_error("Couldnt set HW encryption");
236 goto out; 235 goto out;
237 } 236 }
238 237
@@ -241,27 +240,27 @@ out:
241 return ret; 240 return ret;
242} 241}
243 242
244int wl12xx_acx_mem_map(struct wl12xx *wl, struct acx_header *mem_map, 243int wl1251_acx_mem_map(struct wl1251 *wl, struct acx_header *mem_map,
245 size_t len) 244 size_t len)
246{ 245{
247 int ret; 246 int ret;
248 247
249 wl12xx_debug(DEBUG_ACX, "acx mem map"); 248 wl1251_debug(DEBUG_ACX, "acx mem map");
250 249
251 ret = wl12xx_cmd_interrogate(wl, ACX_MEM_MAP, mem_map, len); 250 ret = wl1251_cmd_interrogate(wl, ACX_MEM_MAP, mem_map, len);
252 if (ret < 0) 251 if (ret < 0)
253 return ret; 252 return ret;
254 253
255 return 0; 254 return 0;
256} 255}
257 256
258int wl12xx_acx_data_path_params(struct wl12xx *wl, 257int wl1251_acx_data_path_params(struct wl1251 *wl,
259 struct acx_data_path_params_resp *resp) 258 struct acx_data_path_params_resp *resp)
260{ 259{
261 struct acx_data_path_params *params; 260 struct acx_data_path_params *params;
262 int ret; 261 int ret;
263 262
264 wl12xx_debug(DEBUG_ACX, "acx data path params"); 263 wl1251_debug(DEBUG_ACX, "acx data path params");
265 264
266 params = kzalloc(sizeof(*params), GFP_KERNEL); 265 params = kzalloc(sizeof(*params), GFP_KERNEL);
267 if (!params) { 266 if (!params) {
@@ -281,20 +280,20 @@ int wl12xx_acx_data_path_params(struct wl12xx *wl,
281 280
282 params->tx_complete_timeout = DP_TX_COMPLETE_TIME_OUT; 281 params->tx_complete_timeout = DP_TX_COMPLETE_TIME_OUT;
283 282
284 ret = wl12xx_cmd_configure(wl, ACX_DATA_PATH_PARAMS, 283 ret = wl1251_cmd_configure(wl, ACX_DATA_PATH_PARAMS,
285 params, sizeof(*params)); 284 params, sizeof(*params));
286 if (ret < 0) 285 if (ret < 0)
287 goto out; 286 goto out;
288 287
289 /* FIXME: shouldn't this be ACX_DATA_PATH_RESP_PARAMS? */ 288 /* FIXME: shouldn't this be ACX_DATA_PATH_RESP_PARAMS? */
290 ret = wl12xx_cmd_interrogate(wl, ACX_DATA_PATH_PARAMS, 289 ret = wl1251_cmd_interrogate(wl, ACX_DATA_PATH_PARAMS,
291 resp, sizeof(*resp)); 290 resp, sizeof(*resp));
292 291
293 if (ret < 0) { 292 if (ret < 0) {
294 wl12xx_warning("failed to read data path parameters: %d", ret); 293 wl1251_warning("failed to read data path parameters: %d", ret);
295 goto out; 294 goto out;
296 } else if (resp->header.cmd.status != CMD_STATUS_SUCCESS) { 295 } else if (resp->header.cmd.status != CMD_STATUS_SUCCESS) {
297 wl12xx_warning("data path parameter acx status failed"); 296 wl1251_warning("data path parameter acx status failed");
298 ret = -EIO; 297 ret = -EIO;
299 goto out; 298 goto out;
300 } 299 }
@@ -304,12 +303,12 @@ out:
304 return ret; 303 return ret;
305} 304}
306 305
307int wl12xx_acx_rx_msdu_life_time(struct wl12xx *wl, u32 life_time) 306int wl1251_acx_rx_msdu_life_time(struct wl1251 *wl, u32 life_time)
308{ 307{
309 struct acx_rx_msdu_lifetime *acx; 308 struct acx_rx_msdu_lifetime *acx;
310 int ret; 309 int ret;
311 310
312 wl12xx_debug(DEBUG_ACX, "acx rx msdu life time"); 311 wl1251_debug(DEBUG_ACX, "acx rx msdu life time");
313 312
314 acx = kzalloc(sizeof(*acx), GFP_KERNEL); 313 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
315 if (!acx) { 314 if (!acx) {
@@ -318,10 +317,10 @@ int wl12xx_acx_rx_msdu_life_time(struct wl12xx *wl, u32 life_time)
318 } 317 }
319 318
320 acx->lifetime = life_time; 319 acx->lifetime = life_time;
321 ret = wl12xx_cmd_configure(wl, DOT11_RX_MSDU_LIFE_TIME, 320 ret = wl1251_cmd_configure(wl, DOT11_RX_MSDU_LIFE_TIME,
322 acx, sizeof(*acx)); 321 acx, sizeof(*acx));
323 if (ret < 0) { 322 if (ret < 0) {
324 wl12xx_warning("failed to set rx msdu life time: %d", ret); 323 wl1251_warning("failed to set rx msdu life time: %d", ret);
325 goto out; 324 goto out;
326 } 325 }
327 326
@@ -330,12 +329,12 @@ out:
330 return ret; 329 return ret;
331} 330}
332 331
333int wl12xx_acx_rx_config(struct wl12xx *wl, u32 config, u32 filter) 332int wl1251_acx_rx_config(struct wl1251 *wl, u32 config, u32 filter)
334{ 333{
335 struct acx_rx_config *rx_config; 334 struct acx_rx_config *rx_config;
336 int ret; 335 int ret;
337 336
338 wl12xx_debug(DEBUG_ACX, "acx rx config"); 337 wl1251_debug(DEBUG_ACX, "acx rx config");
339 338
340 rx_config = kzalloc(sizeof(*rx_config), GFP_KERNEL); 339 rx_config = kzalloc(sizeof(*rx_config), GFP_KERNEL);
341 if (!rx_config) { 340 if (!rx_config) {
@@ -346,10 +345,10 @@ int wl12xx_acx_rx_config(struct wl12xx *wl, u32 config, u32 filter)
346 rx_config->config_options = config; 345 rx_config->config_options = config;
347 rx_config->filter_options = filter; 346 rx_config->filter_options = filter;
348 347
349 ret = wl12xx_cmd_configure(wl, ACX_RX_CFG, 348 ret = wl1251_cmd_configure(wl, ACX_RX_CFG,
350 rx_config, sizeof(*rx_config)); 349 rx_config, sizeof(*rx_config));
351 if (ret < 0) { 350 if (ret < 0) {
352 wl12xx_warning("failed to set rx config: %d", ret); 351 wl1251_warning("failed to set rx config: %d", ret);
353 goto out; 352 goto out;
354 } 353 }
355 354
@@ -358,12 +357,12 @@ out:
358 return ret; 357 return ret;
359} 358}
360 359
361int wl12xx_acx_pd_threshold(struct wl12xx *wl) 360int wl1251_acx_pd_threshold(struct wl1251 *wl)
362{ 361{
363 struct acx_packet_detection *pd; 362 struct acx_packet_detection *pd;
364 int ret; 363 int ret;
365 364
366 wl12xx_debug(DEBUG_ACX, "acx data pd threshold"); 365 wl1251_debug(DEBUG_ACX, "acx data pd threshold");
367 366
368 pd = kzalloc(sizeof(*pd), GFP_KERNEL); 367 pd = kzalloc(sizeof(*pd), GFP_KERNEL);
369 if (!pd) { 368 if (!pd) {
@@ -373,9 +372,9 @@ int wl12xx_acx_pd_threshold(struct wl12xx *wl)
373 372
374 /* FIXME: threshold value not set */ 373 /* FIXME: threshold value not set */
375 374
376 ret = wl12xx_cmd_configure(wl, ACX_PD_THRESHOLD, pd, sizeof(*pd)); 375 ret = wl1251_cmd_configure(wl, ACX_PD_THRESHOLD, pd, sizeof(*pd));
377 if (ret < 0) { 376 if (ret < 0) {
378 wl12xx_warning("failed to set pd threshold: %d", ret); 377 wl1251_warning("failed to set pd threshold: %d", ret);
379 goto out; 378 goto out;
380 } 379 }
381 380
@@ -384,12 +383,12 @@ out:
384 return 0; 383 return 0;
385} 384}
386 385
387int wl12xx_acx_slot(struct wl12xx *wl, enum acx_slot_type slot_time) 386int wl1251_acx_slot(struct wl1251 *wl, enum acx_slot_type slot_time)
388{ 387{
389 struct acx_slot *slot; 388 struct acx_slot *slot;
390 int ret; 389 int ret;
391 390
392 wl12xx_debug(DEBUG_ACX, "acx slot"); 391 wl1251_debug(DEBUG_ACX, "acx slot");
393 392
394 slot = kzalloc(sizeof(*slot), GFP_KERNEL); 393 slot = kzalloc(sizeof(*slot), GFP_KERNEL);
395 if (!slot) { 394 if (!slot) {
@@ -400,9 +399,9 @@ int wl12xx_acx_slot(struct wl12xx *wl, enum acx_slot_type slot_time)
400 slot->wone_index = STATION_WONE_INDEX; 399 slot->wone_index = STATION_WONE_INDEX;
401 slot->slot_time = slot_time; 400 slot->slot_time = slot_time;
402 401
403 ret = wl12xx_cmd_configure(wl, ACX_SLOT, slot, sizeof(*slot)); 402 ret = wl1251_cmd_configure(wl, ACX_SLOT, slot, sizeof(*slot));
404 if (ret < 0) { 403 if (ret < 0) {
405 wl12xx_warning("failed to set slot time: %d", ret); 404 wl1251_warning("failed to set slot time: %d", ret);
406 goto out; 405 goto out;
407 } 406 }
408 407
@@ -411,12 +410,12 @@ out:
411 return ret; 410 return ret;
412} 411}
413 412
414int wl12xx_acx_group_address_tbl(struct wl12xx *wl) 413int wl1251_acx_group_address_tbl(struct wl1251 *wl)
415{ 414{
416 struct acx_dot11_grp_addr_tbl *acx; 415 struct acx_dot11_grp_addr_tbl *acx;
417 int ret; 416 int ret;
418 417
419 wl12xx_debug(DEBUG_ACX, "acx group address tbl"); 418 wl1251_debug(DEBUG_ACX, "acx group address tbl");
420 419
421 acx = kzalloc(sizeof(*acx), GFP_KERNEL); 420 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
422 if (!acx) { 421 if (!acx) {
@@ -429,10 +428,10 @@ int wl12xx_acx_group_address_tbl(struct wl12xx *wl)
429 acx->num_groups = 0; 428 acx->num_groups = 0;
430 memset(acx->mac_table, 0, ADDRESS_GROUP_MAX_LEN); 429 memset(acx->mac_table, 0, ADDRESS_GROUP_MAX_LEN);
431 430
432 ret = wl12xx_cmd_configure(wl, DOT11_GROUP_ADDRESS_TBL, 431 ret = wl1251_cmd_configure(wl, DOT11_GROUP_ADDRESS_TBL,
433 acx, sizeof(*acx)); 432 acx, sizeof(*acx));
434 if (ret < 0) { 433 if (ret < 0) {
435 wl12xx_warning("failed to set group addr table: %d", ret); 434 wl1251_warning("failed to set group addr table: %d", ret);
436 goto out; 435 goto out;
437 } 436 }
438 437
@@ -441,7 +440,7 @@ out:
441 return ret; 440 return ret;
442} 441}
443 442
444int wl12xx_acx_service_period_timeout(struct wl12xx *wl) 443int wl1251_acx_service_period_timeout(struct wl1251 *wl)
445{ 444{
446 struct acx_rx_timeout *rx_timeout; 445 struct acx_rx_timeout *rx_timeout;
447 int ret; 446 int ret;
@@ -452,15 +451,15 @@ int wl12xx_acx_service_period_timeout(struct wl12xx *wl)
452 goto out; 451 goto out;
453 } 452 }
454 453
455 wl12xx_debug(DEBUG_ACX, "acx service period timeout"); 454 wl1251_debug(DEBUG_ACX, "acx service period timeout");
456 455
457 rx_timeout->ps_poll_timeout = RX_TIMEOUT_PS_POLL_DEF; 456 rx_timeout->ps_poll_timeout = RX_TIMEOUT_PS_POLL_DEF;
458 rx_timeout->upsd_timeout = RX_TIMEOUT_UPSD_DEF; 457 rx_timeout->upsd_timeout = RX_TIMEOUT_UPSD_DEF;
459 458
460 ret = wl12xx_cmd_configure(wl, ACX_SERVICE_PERIOD_TIMEOUT, 459 ret = wl1251_cmd_configure(wl, ACX_SERVICE_PERIOD_TIMEOUT,
461 rx_timeout, sizeof(*rx_timeout)); 460 rx_timeout, sizeof(*rx_timeout));
462 if (ret < 0) { 461 if (ret < 0) {
463 wl12xx_warning("failed to set service period timeout: %d", 462 wl1251_warning("failed to set service period timeout: %d",
464 ret); 463 ret);
465 goto out; 464 goto out;
466 } 465 }
@@ -470,12 +469,12 @@ out:
470 return ret; 469 return ret;
471} 470}
472 471
473int wl12xx_acx_rts_threshold(struct wl12xx *wl, u16 rts_threshold) 472int wl1251_acx_rts_threshold(struct wl1251 *wl, u16 rts_threshold)
474{ 473{
475 struct acx_rts_threshold *rts; 474 struct acx_rts_threshold *rts;
476 int ret; 475 int ret;
477 476
478 wl12xx_debug(DEBUG_ACX, "acx rts threshold"); 477 wl1251_debug(DEBUG_ACX, "acx rts threshold");
479 478
480 rts = kzalloc(sizeof(*rts), GFP_KERNEL); 479 rts = kzalloc(sizeof(*rts), GFP_KERNEL);
481 if (!rts) { 480 if (!rts) {
@@ -485,9 +484,9 @@ int wl12xx_acx_rts_threshold(struct wl12xx *wl, u16 rts_threshold)
485 484
486 rts->threshold = rts_threshold; 485 rts->threshold = rts_threshold;
487 486
488 ret = wl12xx_cmd_configure(wl, DOT11_RTS_THRESHOLD, rts, sizeof(*rts)); 487 ret = wl1251_cmd_configure(wl, DOT11_RTS_THRESHOLD, rts, sizeof(*rts));
489 if (ret < 0) { 488 if (ret < 0) {
490 wl12xx_warning("failed to set rts threshold: %d", ret); 489 wl1251_warning("failed to set rts threshold: %d", ret);
491 goto out; 490 goto out;
492 } 491 }
493 492
@@ -496,12 +495,12 @@ out:
496 return ret; 495 return ret;
497} 496}
498 497
499int wl12xx_acx_beacon_filter_opt(struct wl12xx *wl) 498int wl1251_acx_beacon_filter_opt(struct wl1251 *wl)
500{ 499{
501 struct acx_beacon_filter_option *beacon_filter; 500 struct acx_beacon_filter_option *beacon_filter;
502 int ret; 501 int ret;
503 502
504 wl12xx_debug(DEBUG_ACX, "acx beacon filter opt"); 503 wl1251_debug(DEBUG_ACX, "acx beacon filter opt");
505 504
506 beacon_filter = kzalloc(sizeof(*beacon_filter), GFP_KERNEL); 505 beacon_filter = kzalloc(sizeof(*beacon_filter), GFP_KERNEL);
507 if (!beacon_filter) { 506 if (!beacon_filter) {
@@ -512,10 +511,10 @@ int wl12xx_acx_beacon_filter_opt(struct wl12xx *wl)
512 beacon_filter->enable = 0; 511 beacon_filter->enable = 0;
513 beacon_filter->max_num_beacons = 0; 512 beacon_filter->max_num_beacons = 0;
514 513
515 ret = wl12xx_cmd_configure(wl, ACX_BEACON_FILTER_OPT, 514 ret = wl1251_cmd_configure(wl, ACX_BEACON_FILTER_OPT,
516 beacon_filter, sizeof(*beacon_filter)); 515 beacon_filter, sizeof(*beacon_filter));
517 if (ret < 0) { 516 if (ret < 0) {
518 wl12xx_warning("failed to set beacon filter opt: %d", ret); 517 wl1251_warning("failed to set beacon filter opt: %d", ret);
519 goto out; 518 goto out;
520 } 519 }
521 520
@@ -524,12 +523,12 @@ out:
524 return ret; 523 return ret;
525} 524}
526 525
527int wl12xx_acx_beacon_filter_table(struct wl12xx *wl) 526int wl1251_acx_beacon_filter_table(struct wl1251 *wl)
528{ 527{
529 struct acx_beacon_filter_ie_table *ie_table; 528 struct acx_beacon_filter_ie_table *ie_table;
530 int ret; 529 int ret;
531 530
532 wl12xx_debug(DEBUG_ACX, "acx beacon filter table"); 531 wl1251_debug(DEBUG_ACX, "acx beacon filter table");
533 532
534 ie_table = kzalloc(sizeof(*ie_table), GFP_KERNEL); 533 ie_table = kzalloc(sizeof(*ie_table), GFP_KERNEL);
535 if (!ie_table) { 534 if (!ie_table) {
@@ -540,10 +539,10 @@ int wl12xx_acx_beacon_filter_table(struct wl12xx *wl)
540 ie_table->num_ie = 0; 539 ie_table->num_ie = 0;
541 memset(ie_table->table, 0, BEACON_FILTER_TABLE_MAX_SIZE); 540 memset(ie_table->table, 0, BEACON_FILTER_TABLE_MAX_SIZE);
542 541
543 ret = wl12xx_cmd_configure(wl, ACX_BEACON_FILTER_TABLE, 542 ret = wl1251_cmd_configure(wl, ACX_BEACON_FILTER_TABLE,
544 ie_table, sizeof(*ie_table)); 543 ie_table, sizeof(*ie_table));
545 if (ret < 0) { 544 if (ret < 0) {
546 wl12xx_warning("failed to set beacon filter table: %d", ret); 545 wl1251_warning("failed to set beacon filter table: %d", ret);
547 goto out; 546 goto out;
548 } 547 }
549 548
@@ -552,12 +551,12 @@ out:
552 return ret; 551 return ret;
553} 552}
554 553
555int wl12xx_acx_sg_enable(struct wl12xx *wl) 554int wl1251_acx_sg_enable(struct wl1251 *wl)
556{ 555{
557 struct acx_bt_wlan_coex *pta; 556 struct acx_bt_wlan_coex *pta;
558 int ret; 557 int ret;
559 558
560 wl12xx_debug(DEBUG_ACX, "acx sg enable"); 559 wl1251_debug(DEBUG_ACX, "acx sg enable");
561 560
562 pta = kzalloc(sizeof(*pta), GFP_KERNEL); 561 pta = kzalloc(sizeof(*pta), GFP_KERNEL);
563 if (!pta) { 562 if (!pta) {
@@ -567,9 +566,9 @@ int wl12xx_acx_sg_enable(struct wl12xx *wl)
567 566
568 pta->enable = SG_ENABLE; 567 pta->enable = SG_ENABLE;
569 568
570 ret = wl12xx_cmd_configure(wl, ACX_SG_ENABLE, pta, sizeof(*pta)); 569 ret = wl1251_cmd_configure(wl, ACX_SG_ENABLE, pta, sizeof(*pta));
571 if (ret < 0) { 570 if (ret < 0) {
572 wl12xx_warning("failed to set softgemini enable: %d", ret); 571 wl1251_warning("failed to set softgemini enable: %d", ret);
573 goto out; 572 goto out;
574 } 573 }
575 574
@@ -578,12 +577,12 @@ out:
578 return ret; 577 return ret;
579} 578}
580 579
581int wl12xx_acx_sg_cfg(struct wl12xx *wl) 580int wl1251_acx_sg_cfg(struct wl1251 *wl)
582{ 581{
583 struct acx_bt_wlan_coex_param *param; 582 struct acx_bt_wlan_coex_param *param;
584 int ret; 583 int ret;
585 584
586 wl12xx_debug(DEBUG_ACX, "acx sg cfg"); 585 wl1251_debug(DEBUG_ACX, "acx sg cfg");
587 586
588 param = kzalloc(sizeof(*param), GFP_KERNEL); 587 param = kzalloc(sizeof(*param), GFP_KERNEL);
589 if (!param) { 588 if (!param) {
@@ -621,9 +620,9 @@ int wl12xx_acx_sg_cfg(struct wl12xx *wl)
621 param->pta_auto_mode_enable = PTA_AUTO_MODE_NO_CTS_DEF; 620 param->pta_auto_mode_enable = PTA_AUTO_MODE_NO_CTS_DEF;
622 param->bt_hp_respected_num = PTA_BT_HP_RESPECTED_DEF; 621 param->bt_hp_respected_num = PTA_BT_HP_RESPECTED_DEF;
623 622
624 ret = wl12xx_cmd_configure(wl, ACX_SG_CFG, param, sizeof(*param)); 623 ret = wl1251_cmd_configure(wl, ACX_SG_CFG, param, sizeof(*param));
625 if (ret < 0) { 624 if (ret < 0) {
626 wl12xx_warning("failed to set sg config: %d", ret); 625 wl1251_warning("failed to set sg config: %d", ret);
627 goto out; 626 goto out;
628 } 627 }
629 628
@@ -632,12 +631,12 @@ out:
632 return ret; 631 return ret;
633} 632}
634 633
635int wl12xx_acx_cca_threshold(struct wl12xx *wl) 634int wl1251_acx_cca_threshold(struct wl1251 *wl)
636{ 635{
637 struct acx_energy_detection *detection; 636 struct acx_energy_detection *detection;
638 int ret; 637 int ret;
639 638
640 wl12xx_debug(DEBUG_ACX, "acx cca threshold"); 639 wl1251_debug(DEBUG_ACX, "acx cca threshold");
641 640
642 detection = kzalloc(sizeof(*detection), GFP_KERNEL); 641 detection = kzalloc(sizeof(*detection), GFP_KERNEL);
643 if (!detection) { 642 if (!detection) {
@@ -648,10 +647,10 @@ int wl12xx_acx_cca_threshold(struct wl12xx *wl)
648 detection->rx_cca_threshold = CCA_THRSH_DISABLE_ENERGY_D; 647 detection->rx_cca_threshold = CCA_THRSH_DISABLE_ENERGY_D;
649 detection->tx_energy_detection = 0; 648 detection->tx_energy_detection = 0;
650 649
651 ret = wl12xx_cmd_configure(wl, ACX_CCA_THRESHOLD, 650 ret = wl1251_cmd_configure(wl, ACX_CCA_THRESHOLD,
652 detection, sizeof(*detection)); 651 detection, sizeof(*detection));
653 if (ret < 0) { 652 if (ret < 0) {
654 wl12xx_warning("failed to set cca threshold: %d", ret); 653 wl1251_warning("failed to set cca threshold: %d", ret);
655 return ret; 654 return ret;
656 } 655 }
657 656
@@ -660,12 +659,12 @@ out:
660 return ret; 659 return ret;
661} 660}
662 661
663int wl12xx_acx_bcn_dtim_options(struct wl12xx *wl) 662int wl1251_acx_bcn_dtim_options(struct wl1251 *wl)
664{ 663{
665 struct acx_beacon_broadcast *bb; 664 struct acx_beacon_broadcast *bb;
666 int ret; 665 int ret;
667 666
668 wl12xx_debug(DEBUG_ACX, "acx bcn dtim options"); 667 wl1251_debug(DEBUG_ACX, "acx bcn dtim options");
669 668
670 bb = kzalloc(sizeof(*bb), GFP_KERNEL); 669 bb = kzalloc(sizeof(*bb), GFP_KERNEL);
671 if (!bb) { 670 if (!bb) {
@@ -678,9 +677,9 @@ int wl12xx_acx_bcn_dtim_options(struct wl12xx *wl)
678 bb->rx_broadcast_in_ps = RX_BROADCAST_IN_PS_DEF_VALUE; 677 bb->rx_broadcast_in_ps = RX_BROADCAST_IN_PS_DEF_VALUE;
679 bb->ps_poll_threshold = CONSECUTIVE_PS_POLL_FAILURE_DEF; 678 bb->ps_poll_threshold = CONSECUTIVE_PS_POLL_FAILURE_DEF;
680 679
681 ret = wl12xx_cmd_configure(wl, ACX_BCN_DTIM_OPTIONS, bb, sizeof(*bb)); 680 ret = wl1251_cmd_configure(wl, ACX_BCN_DTIM_OPTIONS, bb, sizeof(*bb));
682 if (ret < 0) { 681 if (ret < 0) {
683 wl12xx_warning("failed to set rx config: %d", ret); 682 wl1251_warning("failed to set rx config: %d", ret);
684 goto out; 683 goto out;
685 } 684 }
686 685
@@ -689,12 +688,12 @@ out:
689 return ret; 688 return ret;
690} 689}
691 690
692int wl12xx_acx_aid(struct wl12xx *wl, u16 aid) 691int wl1251_acx_aid(struct wl1251 *wl, u16 aid)
693{ 692{
694 struct acx_aid *acx_aid; 693 struct acx_aid *acx_aid;
695 int ret; 694 int ret;
696 695
697 wl12xx_debug(DEBUG_ACX, "acx aid"); 696 wl1251_debug(DEBUG_ACX, "acx aid");
698 697
699 acx_aid = kzalloc(sizeof(*acx_aid), GFP_KERNEL); 698 acx_aid = kzalloc(sizeof(*acx_aid), GFP_KERNEL);
700 if (!acx_aid) { 699 if (!acx_aid) {
@@ -704,9 +703,9 @@ int wl12xx_acx_aid(struct wl12xx *wl, u16 aid)
704 703
705 acx_aid->aid = aid; 704 acx_aid->aid = aid;
706 705
707 ret = wl12xx_cmd_configure(wl, ACX_AID, acx_aid, sizeof(*acx_aid)); 706 ret = wl1251_cmd_configure(wl, ACX_AID, acx_aid, sizeof(*acx_aid));
708 if (ret < 0) { 707 if (ret < 0) {
709 wl12xx_warning("failed to set aid: %d", ret); 708 wl1251_warning("failed to set aid: %d", ret);
710 goto out; 709 goto out;
711 } 710 }
712 711
@@ -715,12 +714,12 @@ out:
715 return ret; 714 return ret;
716} 715}
717 716
718int wl12xx_acx_event_mbox_mask(struct wl12xx *wl, u32 event_mask) 717int wl1251_acx_event_mbox_mask(struct wl1251 *wl, u32 event_mask)
719{ 718{
720 struct acx_event_mask *mask; 719 struct acx_event_mask *mask;
721 int ret; 720 int ret;
722 721
723 wl12xx_debug(DEBUG_ACX, "acx event mbox mask"); 722 wl1251_debug(DEBUG_ACX, "acx event mbox mask");
724 723
725 mask = kzalloc(sizeof(*mask), GFP_KERNEL); 724 mask = kzalloc(sizeof(*mask), GFP_KERNEL);
726 if (!mask) { 725 if (!mask) {
@@ -733,10 +732,10 @@ int wl12xx_acx_event_mbox_mask(struct wl12xx *wl, u32 event_mask)
733 732
734 mask->event_mask = event_mask; 733 mask->event_mask = event_mask;
735 734
736 ret = wl12xx_cmd_configure(wl, ACX_EVENT_MBOX_MASK, 735 ret = wl1251_cmd_configure(wl, ACX_EVENT_MBOX_MASK,
737 mask, sizeof(*mask)); 736 mask, sizeof(*mask));
738 if (ret < 0) { 737 if (ret < 0) {
739 wl12xx_warning("failed to set acx_event_mbox_mask: %d", ret); 738 wl1251_warning("failed to set acx_event_mbox_mask: %d", ret);
740 goto out; 739 goto out;
741 } 740 }
742 741
@@ -745,12 +744,12 @@ out:
745 return ret; 744 return ret;
746} 745}
747 746
748int wl12xx_acx_set_preamble(struct wl12xx *wl, enum acx_preamble_type preamble) 747int wl1251_acx_set_preamble(struct wl1251 *wl, enum acx_preamble_type preamble)
749{ 748{
750 struct acx_preamble *acx; 749 struct acx_preamble *acx;
751 int ret; 750 int ret;
752 751
753 wl12xx_debug(DEBUG_ACX, "acx_set_preamble"); 752 wl1251_debug(DEBUG_ACX, "acx_set_preamble");
754 753
755 acx = kzalloc(sizeof(*acx), GFP_KERNEL); 754 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
756 if (!acx) { 755 if (!acx) {
@@ -760,9 +759,9 @@ int wl12xx_acx_set_preamble(struct wl12xx *wl, enum acx_preamble_type preamble)
760 759
761 acx->preamble = preamble; 760 acx->preamble = preamble;
762 761
763 ret = wl12xx_cmd_configure(wl, ACX_PREAMBLE_TYPE, acx, sizeof(*acx)); 762 ret = wl1251_cmd_configure(wl, ACX_PREAMBLE_TYPE, acx, sizeof(*acx));
764 if (ret < 0) { 763 if (ret < 0) {
765 wl12xx_warning("Setting of preamble failed: %d", ret); 764 wl1251_warning("Setting of preamble failed: %d", ret);
766 goto out; 765 goto out;
767 } 766 }
768 767
@@ -771,13 +770,13 @@ out:
771 return ret; 770 return ret;
772} 771}
773 772
774int wl12xx_acx_cts_protect(struct wl12xx *wl, 773int wl1251_acx_cts_protect(struct wl1251 *wl,
775 enum acx_ctsprotect_type ctsprotect) 774 enum acx_ctsprotect_type ctsprotect)
776{ 775{
777 struct acx_ctsprotect *acx; 776 struct acx_ctsprotect *acx;
778 int ret; 777 int ret;
779 778
780 wl12xx_debug(DEBUG_ACX, "acx_set_ctsprotect"); 779 wl1251_debug(DEBUG_ACX, "acx_set_ctsprotect");
781 780
782 acx = kzalloc(sizeof(*acx), GFP_KERNEL); 781 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
783 if (!acx) { 782 if (!acx) {
@@ -787,9 +786,9 @@ int wl12xx_acx_cts_protect(struct wl12xx *wl,
787 786
788 acx->ctsprotect = ctsprotect; 787 acx->ctsprotect = ctsprotect;
789 788
790 ret = wl12xx_cmd_configure(wl, ACX_CTS_PROTECTION, acx, sizeof(*acx)); 789 ret = wl1251_cmd_configure(wl, ACX_CTS_PROTECTION, acx, sizeof(*acx));
791 if (ret < 0) { 790 if (ret < 0) {
792 wl12xx_warning("Setting of ctsprotect failed: %d", ret); 791 wl1251_warning("Setting of ctsprotect failed: %d", ret);
793 goto out; 792 goto out;
794 } 793 }
795 794
@@ -798,7 +797,7 @@ out:
798 return ret; 797 return ret;
799} 798}
800 799
801int wl12xx_acx_tsf_info(struct wl12xx *wl, u64 *mactime) 800int wl1251_acx_tsf_info(struct wl1251 *wl, u64 *mactime)
802{ 801{
803 struct acx_tsf_info *tsf_info; 802 struct acx_tsf_info *tsf_info;
804 int ret; 803 int ret;
@@ -809,10 +808,10 @@ int wl12xx_acx_tsf_info(struct wl12xx *wl, u64 *mactime)
809 goto out; 808 goto out;
810 } 809 }
811 810
812 ret = wl12xx_cmd_interrogate(wl, ACX_TSF_INFO, 811 ret = wl1251_cmd_interrogate(wl, ACX_TSF_INFO,
813 tsf_info, sizeof(*tsf_info)); 812 tsf_info, sizeof(*tsf_info));
814 if (ret < 0) { 813 if (ret < 0) {
815 wl12xx_warning("ACX_FW_REV interrogate failed"); 814 wl1251_warning("ACX_FW_REV interrogate failed");
816 goto out; 815 goto out;
817 } 816 }
818 817
@@ -824,16 +823,16 @@ out:
824 return ret; 823 return ret;
825} 824}
826 825
827int wl12xx_acx_statistics(struct wl12xx *wl, struct acx_statistics *stats) 826int wl1251_acx_statistics(struct wl1251 *wl, struct acx_statistics *stats)
828{ 827{
829 int ret; 828 int ret;
830 829
831 wl12xx_debug(DEBUG_ACX, "acx statistics"); 830 wl1251_debug(DEBUG_ACX, "acx statistics");
832 831
833 ret = wl12xx_cmd_interrogate(wl, ACX_STATISTICS, stats, 832 ret = wl1251_cmd_interrogate(wl, ACX_STATISTICS, stats,
834 sizeof(*stats)); 833 sizeof(*stats));
835 if (ret < 0) { 834 if (ret < 0) {
836 wl12xx_warning("acx statistics failed: %d", ret); 835 wl1251_warning("acx statistics failed: %d", ret);
837 return -ENOMEM; 836 return -ENOMEM;
838 } 837 }
839 838
diff --git a/drivers/net/wireless/wl12xx/wl1251_acx.h b/drivers/net/wireless/wl12xx/wl1251_acx.h
index a23912014b9..2e7b1933a8f 100644
--- a/drivers/net/wireless/wl12xx/wl1251_acx.h
+++ b/drivers/net/wireless/wl12xx/wl1251_acx.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (c) 1998-2007 Texas Instruments Incorporated 4 * Copyright (c) 1998-2007 Texas Instruments Incorporated
5 * Copyright (C) 2008 Nokia Corporation 5 * Copyright (C) 2008 Nokia Corporation
@@ -22,15 +22,15 @@
22 * 22 *
23 */ 23 */
24 24
25#ifndef __WL12XX_ACX_H__ 25#ifndef __WL1251_ACX_H__
26#define __WL12XX_ACX_H__ 26#define __WL1251_ACX_H__
27 27
28#include "wl1251.h" 28#include "wl1251.h"
29#include "wl1251_cmd.h" 29#include "wl1251_cmd.h"
30 30
31/* Target's information element */ 31/* Target's information element */
32struct acx_header { 32struct acx_header {
33 struct wl12xx_cmd_header cmd; 33 struct wl1251_cmd_header cmd;
34 34
35 /* acx (or information element) header */ 35 /* acx (or information element) header */
36 u16 id; 36 u16 id;
@@ -91,15 +91,15 @@ struct acx_revision {
91 u32 hw_version; 91 u32 hw_version;
92} __attribute__ ((packed)); 92} __attribute__ ((packed));
93 93
94enum wl12xx_psm_mode { 94enum wl1251_psm_mode {
95 /* Active mode */ 95 /* Active mode */
96 WL12XX_PSM_CAM = 0, 96 WL1251_PSM_CAM = 0,
97 97
98 /* Power save mode */ 98 /* Power save mode */
99 WL12XX_PSM_PS = 1, 99 WL1251_PSM_PS = 1,
100 100
101 /* Extreme low power */ 101 /* Extreme low power */
102 WL12XX_PSM_ELP = 2, 102 WL1251_PSM_ELP = 2,
103}; 103};
104 104
105struct acx_sleep_auth { 105struct acx_sleep_auth {
@@ -1108,39 +1108,39 @@ enum {
1108}; 1108};
1109 1109
1110 1110
1111int wl12xx_acx_frame_rates(struct wl12xx *wl, u8 ctrl_rate, u8 ctrl_mod, 1111int wl1251_acx_frame_rates(struct wl1251 *wl, u8 ctrl_rate, u8 ctrl_mod,
1112 u8 mgt_rate, u8 mgt_mod); 1112 u8 mgt_rate, u8 mgt_mod);
1113int wl12xx_acx_station_id(struct wl12xx *wl); 1113int wl1251_acx_station_id(struct wl1251 *wl);
1114int wl12xx_acx_default_key(struct wl12xx *wl, u8 key_id); 1114int wl1251_acx_default_key(struct wl1251 *wl, u8 key_id);
1115int wl12xx_acx_wake_up_conditions(struct wl12xx *wl, u8 wake_up_event, 1115int wl1251_acx_wake_up_conditions(struct wl1251 *wl, u8 wake_up_event,
1116 u8 listen_interval); 1116 u8 listen_interval);
1117int wl12xx_acx_sleep_auth(struct wl12xx *wl, u8 sleep_auth); 1117int wl1251_acx_sleep_auth(struct wl1251 *wl, u8 sleep_auth);
1118int wl12xx_acx_fw_version(struct wl12xx *wl, char *buf, size_t len); 1118int wl1251_acx_fw_version(struct wl1251 *wl, char *buf, size_t len);
1119int wl12xx_acx_tx_power(struct wl12xx *wl, int power); 1119int wl1251_acx_tx_power(struct wl1251 *wl, int power);
1120int wl12xx_acx_feature_cfg(struct wl12xx *wl); 1120int wl1251_acx_feature_cfg(struct wl1251 *wl);
1121int wl12xx_acx_mem_map(struct wl12xx *wl, 1121int wl1251_acx_mem_map(struct wl1251 *wl,
1122 struct acx_header *mem_map, size_t len); 1122 struct acx_header *mem_map, size_t len);
1123int wl12xx_acx_data_path_params(struct wl12xx *wl, 1123int wl1251_acx_data_path_params(struct wl1251 *wl,
1124 struct acx_data_path_params_resp *data_path); 1124 struct acx_data_path_params_resp *data_path);
1125int wl12xx_acx_rx_msdu_life_time(struct wl12xx *wl, u32 life_time); 1125int wl1251_acx_rx_msdu_life_time(struct wl1251 *wl, u32 life_time);
1126int wl12xx_acx_rx_config(struct wl12xx *wl, u32 config, u32 filter); 1126int wl1251_acx_rx_config(struct wl1251 *wl, u32 config, u32 filter);
1127int wl12xx_acx_pd_threshold(struct wl12xx *wl); 1127int wl1251_acx_pd_threshold(struct wl1251 *wl);
1128int wl12xx_acx_slot(struct wl12xx *wl, enum acx_slot_type slot_time); 1128int wl1251_acx_slot(struct wl1251 *wl, enum acx_slot_type slot_time);
1129int wl12xx_acx_group_address_tbl(struct wl12xx *wl); 1129int wl1251_acx_group_address_tbl(struct wl1251 *wl);
1130int wl12xx_acx_service_period_timeout(struct wl12xx *wl); 1130int wl1251_acx_service_period_timeout(struct wl1251 *wl);
1131int wl12xx_acx_rts_threshold(struct wl12xx *wl, u16 rts_threshold); 1131int wl1251_acx_rts_threshold(struct wl1251 *wl, u16 rts_threshold);
1132int wl12xx_acx_beacon_filter_opt(struct wl12xx *wl); 1132int wl1251_acx_beacon_filter_opt(struct wl1251 *wl);
1133int wl12xx_acx_beacon_filter_table(struct wl12xx *wl); 1133int wl1251_acx_beacon_filter_table(struct wl1251 *wl);
1134int wl12xx_acx_sg_enable(struct wl12xx *wl); 1134int wl1251_acx_sg_enable(struct wl1251 *wl);
1135int wl12xx_acx_sg_cfg(struct wl12xx *wl); 1135int wl1251_acx_sg_cfg(struct wl1251 *wl);
1136int wl12xx_acx_cca_threshold(struct wl12xx *wl); 1136int wl1251_acx_cca_threshold(struct wl1251 *wl);
1137int wl12xx_acx_bcn_dtim_options(struct wl12xx *wl); 1137int wl1251_acx_bcn_dtim_options(struct wl1251 *wl);
1138int wl12xx_acx_aid(struct wl12xx *wl, u16 aid); 1138int wl1251_acx_aid(struct wl1251 *wl, u16 aid);
1139int wl12xx_acx_event_mbox_mask(struct wl12xx *wl, u32 event_mask); 1139int wl1251_acx_event_mbox_mask(struct wl1251 *wl, u32 event_mask);
1140int wl12xx_acx_set_preamble(struct wl12xx *wl, enum acx_preamble_type preamble); 1140int wl1251_acx_set_preamble(struct wl1251 *wl, enum acx_preamble_type preamble);
1141int wl12xx_acx_cts_protect(struct wl12xx *wl, 1141int wl1251_acx_cts_protect(struct wl1251 *wl,
1142 enum acx_ctsprotect_type ctsprotect); 1142 enum acx_ctsprotect_type ctsprotect);
1143int wl12xx_acx_statistics(struct wl12xx *wl, struct acx_statistics *stats); 1143int wl1251_acx_statistics(struct wl1251 *wl, struct acx_statistics *stats);
1144int wl12xx_acx_tsf_info(struct wl12xx *wl, u64 *mactime); 1144int wl1251_acx_tsf_info(struct wl1251 *wl, u64 *mactime);
1145 1145
1146#endif /* __WL12XX_ACX_H__ */ 1146#endif /* __WL1251_ACX_H__ */
diff --git a/drivers/net/wireless/wl12xx/wl1251_boot.c b/drivers/net/wireless/wl12xx/wl1251_boot.c
index c52a2085671..d8a155dc2fa 100644
--- a/drivers/net/wireless/wl12xx/wl1251_boot.c
+++ b/drivers/net/wireless/wl12xx/wl1251_boot.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (C) 2008 Nokia Corporation 4 * Copyright (C) 2008 Nokia Corporation
5 * 5 *
@@ -28,37 +28,37 @@
28#include "wl1251_spi.h" 28#include "wl1251_spi.h"
29#include "wl1251_event.h" 29#include "wl1251_event.h"
30 30
31static void wl12xx_boot_enable_interrupts(struct wl12xx *wl) 31static void wl1251_boot_enable_interrupts(struct wl1251 *wl)
32{ 32{
33 enable_irq(wl->irq); 33 enable_irq(wl->irq);
34} 34}
35 35
36void wl12xx_boot_target_enable_interrupts(struct wl12xx *wl) 36void wl1251_boot_target_enable_interrupts(struct wl1251 *wl)
37{ 37{
38 wl12xx_reg_write32(wl, ACX_REG_INTERRUPT_MASK, ~(wl->intr_mask)); 38 wl1251_reg_write32(wl, ACX_REG_INTERRUPT_MASK, ~(wl->intr_mask));
39 wl12xx_reg_write32(wl, HI_CFG, HI_CFG_DEF_VAL); 39 wl1251_reg_write32(wl, HI_CFG, HI_CFG_DEF_VAL);
40} 40}
41 41
42int wl12xx_boot_soft_reset(struct wl12xx *wl) 42int wl1251_boot_soft_reset(struct wl1251 *wl)
43{ 43{
44 unsigned long timeout; 44 unsigned long timeout;
45 u32 boot_data; 45 u32 boot_data;
46 46
47 /* perform soft reset */ 47 /* perform soft reset */
48 wl12xx_reg_write32(wl, ACX_REG_SLV_SOFT_RESET, ACX_SLV_SOFT_RESET_BIT); 48 wl1251_reg_write32(wl, ACX_REG_SLV_SOFT_RESET, ACX_SLV_SOFT_RESET_BIT);
49 49
50 /* SOFT_RESET is self clearing */ 50 /* SOFT_RESET is self clearing */
51 timeout = jiffies + usecs_to_jiffies(SOFT_RESET_MAX_TIME); 51 timeout = jiffies + usecs_to_jiffies(SOFT_RESET_MAX_TIME);
52 while (1) { 52 while (1) {
53 boot_data = wl12xx_reg_read32(wl, ACX_REG_SLV_SOFT_RESET); 53 boot_data = wl1251_reg_read32(wl, ACX_REG_SLV_SOFT_RESET);
54 wl12xx_debug(DEBUG_BOOT, "soft reset bootdata 0x%x", boot_data); 54 wl1251_debug(DEBUG_BOOT, "soft reset bootdata 0x%x", boot_data);
55 if ((boot_data & ACX_SLV_SOFT_RESET_BIT) == 0) 55 if ((boot_data & ACX_SLV_SOFT_RESET_BIT) == 0)
56 break; 56 break;
57 57
58 if (time_after(jiffies, timeout)) { 58 if (time_after(jiffies, timeout)) {
59 /* 1.2 check pWhalBus->uSelfClearTime if the 59 /* 1.2 check pWhalBus->uSelfClearTime if the
60 * timeout was reached */ 60 * timeout was reached */
61 wl12xx_error("soft reset timeout"); 61 wl1251_error("soft reset timeout");
62 return -1; 62 return -1;
63 } 63 }
64 64
@@ -66,15 +66,15 @@ int wl12xx_boot_soft_reset(struct wl12xx *wl)
66 } 66 }
67 67
68 /* disable Rx/Tx */ 68 /* disable Rx/Tx */
69 wl12xx_reg_write32(wl, ENABLE, 0x0); 69 wl1251_reg_write32(wl, ENABLE, 0x0);
70 70
71 /* disable auto calibration on start*/ 71 /* disable auto calibration on start*/
72 wl12xx_reg_write32(wl, SPARE_A2, 0xffff); 72 wl1251_reg_write32(wl, SPARE_A2, 0xffff);
73 73
74 return 0; 74 return 0;
75} 75}
76 76
77int wl12xx_boot_init_seq(struct wl12xx *wl) 77int wl1251_boot_init_seq(struct wl1251 *wl)
78{ 78{
79 u32 scr_pad6, init_data, tmp, elp_cmd, ref_freq; 79 u32 scr_pad6, init_data, tmp, elp_cmd, ref_freq;
80 80
@@ -96,23 +96,23 @@ int wl12xx_boot_init_seq(struct wl12xx *wl)
96 }; 96 };
97 97
98 /* read NVS params */ 98 /* read NVS params */
99 scr_pad6 = wl12xx_reg_read32(wl, SCR_PAD6); 99 scr_pad6 = wl1251_reg_read32(wl, SCR_PAD6);
100 wl12xx_debug(DEBUG_BOOT, "scr_pad6 0x%x", scr_pad6); 100 wl1251_debug(DEBUG_BOOT, "scr_pad6 0x%x", scr_pad6);
101 101
102 /* read ELP_CMD */ 102 /* read ELP_CMD */
103 elp_cmd = wl12xx_reg_read32(wl, ELP_CMD); 103 elp_cmd = wl1251_reg_read32(wl, ELP_CMD);
104 wl12xx_debug(DEBUG_BOOT, "elp_cmd 0x%x", elp_cmd); 104 wl1251_debug(DEBUG_BOOT, "elp_cmd 0x%x", elp_cmd);
105 105
106 /* set the BB calibration time to be 300 usec (PLL_CAL_TIME) */ 106 /* set the BB calibration time to be 300 usec (PLL_CAL_TIME) */
107 ref_freq = scr_pad6 & 0x000000FF; 107 ref_freq = scr_pad6 & 0x000000FF;
108 wl12xx_debug(DEBUG_BOOT, "ref_freq 0x%x", ref_freq); 108 wl1251_debug(DEBUG_BOOT, "ref_freq 0x%x", ref_freq);
109 109
110 wl12xx_reg_write32(wl, PLL_CAL_TIME, 0x9); 110 wl1251_reg_write32(wl, PLL_CAL_TIME, 0x9);
111 111
112 /* 112 /*
113 * PG 1.2: set the clock buffer time to be 210 usec (CLK_BUF_TIME) 113 * PG 1.2: set the clock buffer time to be 210 usec (CLK_BUF_TIME)
114 */ 114 */
115 wl12xx_reg_write32(wl, CLK_BUF_TIME, 0x6); 115 wl1251_reg_write32(wl, CLK_BUF_TIME, 0x6);
116 116
117 /* 117 /*
118 * set the clock detect feature to work in the restart wu procedure 118 * set the clock detect feature to work in the restart wu procedure
@@ -120,18 +120,18 @@ int wl12xx_boot_init_seq(struct wl12xx *wl)
120 * (ELP_CFG_MODE[13:12]) 120 * (ELP_CFG_MODE[13:12])
121 */ 121 */
122 tmp = ((scr_pad6 & 0x0000FF00) << 4) | 0x00004000; 122 tmp = ((scr_pad6 & 0x0000FF00) << 4) | 0x00004000;
123 wl12xx_reg_write32(wl, ELP_CFG_MODE, tmp); 123 wl1251_reg_write32(wl, ELP_CFG_MODE, tmp);
124 124
125 /* PG 1.2: enable the BB PLL fix. Enable the PLL_LIMP_CLK_EN_CMD */ 125 /* PG 1.2: enable the BB PLL fix. Enable the PLL_LIMP_CLK_EN_CMD */
126 elp_cmd |= 0x00000040; 126 elp_cmd |= 0x00000040;
127 wl12xx_reg_write32(wl, ELP_CMD, elp_cmd); 127 wl1251_reg_write32(wl, ELP_CMD, elp_cmd);
128 128
129 /* PG 1.2: Set the BB PLL stable time to be 1000usec 129 /* PG 1.2: Set the BB PLL stable time to be 1000usec
130 * (PLL_STABLE_TIME) */ 130 * (PLL_STABLE_TIME) */
131 wl12xx_reg_write32(wl, CFG_PLL_SYNC_CNT, 0x20); 131 wl1251_reg_write32(wl, CFG_PLL_SYNC_CNT, 0x20);
132 132
133 /* PG 1.2: read clock request time */ 133 /* PG 1.2: read clock request time */
134 init_data = wl12xx_reg_read32(wl, CLK_REQ_TIME); 134 init_data = wl1251_reg_read32(wl, CLK_REQ_TIME);
135 135
136 /* 136 /*
137 * PG 1.2: set the clock request time to be ref_clk_settling_time - 137 * PG 1.2: set the clock request time to be ref_clk_settling_time -
@@ -141,35 +141,35 @@ int wl12xx_boot_init_seq(struct wl12xx *wl)
141 tmp = init_data - 0x21; 141 tmp = init_data - 0x21;
142 else 142 else
143 tmp = 0; 143 tmp = 0;
144 wl12xx_reg_write32(wl, CLK_REQ_TIME, tmp); 144 wl1251_reg_write32(wl, CLK_REQ_TIME, tmp);
145 145
146 /* set BB PLL configurations in RF AFE */ 146 /* set BB PLL configurations in RF AFE */
147 wl12xx_reg_write32(wl, 0x003058cc, 0x4B5); 147 wl1251_reg_write32(wl, 0x003058cc, 0x4B5);
148 148
149 /* set RF_AFE_REG_5 */ 149 /* set RF_AFE_REG_5 */
150 wl12xx_reg_write32(wl, 0x003058d4, 0x50); 150 wl1251_reg_write32(wl, 0x003058d4, 0x50);
151 151
152 /* set RF_AFE_CTRL_REG_2 */ 152 /* set RF_AFE_CTRL_REG_2 */
153 wl12xx_reg_write32(wl, 0x00305948, 0x11c001); 153 wl1251_reg_write32(wl, 0x00305948, 0x11c001);
154 154
155 /* 155 /*
156 * change RF PLL and BB PLL divider for VCO clock and adjust VCO 156 * change RF PLL and BB PLL divider for VCO clock and adjust VCO
157 * bais current(RF_AFE_REG_13) 157 * bais current(RF_AFE_REG_13)
158 */ 158 */
159 wl12xx_reg_write32(wl, 0x003058f4, 0x1e); 159 wl1251_reg_write32(wl, 0x003058f4, 0x1e);
160 160
161 /* set BB PLL configurations */ 161 /* set BB PLL configurations */
162 tmp = LUT[ref_freq][LUT_PARAM_INTEGER_DIVIDER] | 0x00017000; 162 tmp = LUT[ref_freq][LUT_PARAM_INTEGER_DIVIDER] | 0x00017000;
163 wl12xx_reg_write32(wl, 0x00305840, tmp); 163 wl1251_reg_write32(wl, 0x00305840, tmp);
164 164
165 /* set fractional divider according to Appendix C-BB PLL 165 /* set fractional divider according to Appendix C-BB PLL
166 * Calculations 166 * Calculations
167 */ 167 */
168 tmp = LUT[ref_freq][LUT_PARAM_FRACTIONAL_DIVIDER]; 168 tmp = LUT[ref_freq][LUT_PARAM_FRACTIONAL_DIVIDER];
169 wl12xx_reg_write32(wl, 0x00305844, tmp); 169 wl1251_reg_write32(wl, 0x00305844, tmp);
170 170
171 /* set the initial data for the sigma delta */ 171 /* set the initial data for the sigma delta */
172 wl12xx_reg_write32(wl, 0x00305848, 0x3039); 172 wl1251_reg_write32(wl, 0x00305848, 0x3039);
173 173
174 /* 174 /*
175 * set the accumulator attenuation value, calibration loop1 175 * set the accumulator attenuation value, calibration loop1
@@ -178,14 +178,14 @@ int wl12xx_boot_init_seq(struct wl12xx *wl)
178 */ 178 */
179 tmp = (LUT[ref_freq][LUT_PARAM_ATTN_BB] << 16) | 179 tmp = (LUT[ref_freq][LUT_PARAM_ATTN_BB] << 16) |
180 (LUT[ref_freq][LUT_PARAM_ALPHA_BB] << 12) | 0x1; 180 (LUT[ref_freq][LUT_PARAM_ALPHA_BB] << 12) | 0x1;
181 wl12xx_reg_write32(wl, 0x00305854, tmp); 181 wl1251_reg_write32(wl, 0x00305854, tmp);
182 182
183 /* 183 /*
184 * set the calibration stop time after holdoff time expires and set 184 * set the calibration stop time after holdoff time expires and set
185 * settling time HOLD_OFF_TIME_BB 185 * settling time HOLD_OFF_TIME_BB
186 */ 186 */
187 tmp = LUT[ref_freq][LUT_PARAM_STOP_TIME_BB] | 0x000A0000; 187 tmp = LUT[ref_freq][LUT_PARAM_STOP_TIME_BB] | 0x000A0000;
188 wl12xx_reg_write32(wl, 0x00305858, tmp); 188 wl1251_reg_write32(wl, 0x00305858, tmp);
189 189
190 /* 190 /*
191 * set BB PLL Loop filter capacitor3- BB_C3[2:0] and set BB PLL 191 * set BB PLL Loop filter capacitor3- BB_C3[2:0] and set BB PLL
@@ -193,7 +193,7 @@ int wl12xx_boot_init_seq(struct wl12xx *wl)
193 * BB_ILOOPF[7:3] 193 * BB_ILOOPF[7:3]
194 */ 194 */
195 tmp = LUT[ref_freq][LUT_PARAM_BB_PLL_LOOP_FILTER] | 0x00000030; 195 tmp = LUT[ref_freq][LUT_PARAM_BB_PLL_LOOP_FILTER] | 0x00000030;
196 wl12xx_reg_write32(wl, 0x003058f8, tmp); 196 wl1251_reg_write32(wl, 0x003058f8, tmp);
197 197
198 /* 198 /*
199 * set regulator output voltage for n divider to 199 * set regulator output voltage for n divider to
@@ -201,10 +201,10 @@ int wl12xx_boot_init_seq(struct wl12xx *wl)
201 * set BB PLL Loop filter capacitor2- BB_C2[7:5], set gain of BB 201 * set BB PLL Loop filter capacitor2- BB_C2[7:5], set gain of BB
202 * PLL auto-call to normal mode- BB_CALGAIN_3DB[8] 202 * PLL auto-call to normal mode- BB_CALGAIN_3DB[8]
203 */ 203 */
204 wl12xx_reg_write32(wl, 0x003058f0, 0x29); 204 wl1251_reg_write32(wl, 0x003058f0, 0x29);
205 205
206 /* enable restart wakeup sequence (ELP_CMD[0]) */ 206 /* enable restart wakeup sequence (ELP_CMD[0]) */
207 wl12xx_reg_write32(wl, ELP_CMD, elp_cmd | 0x1); 207 wl1251_reg_write32(wl, ELP_CMD, elp_cmd | 0x1);
208 208
209 /* restart sequence completed */ 209 /* restart sequence completed */
210 udelay(2000); 210 udelay(2000);
@@ -212,19 +212,19 @@ int wl12xx_boot_init_seq(struct wl12xx *wl)
212 return 0; 212 return 0;
213} 213}
214 214
215int wl12xx_boot_run_firmware(struct wl12xx *wl) 215int wl1251_boot_run_firmware(struct wl1251 *wl)
216{ 216{
217 int loop, ret; 217 int loop, ret;
218 u32 chip_id, interrupt; 218 u32 chip_id, interrupt;
219 219
220 wl->chip.op_set_ecpu_ctrl(wl, ECPU_CONTROL_HALT); 220 wl->chip.op_set_ecpu_ctrl(wl, ECPU_CONTROL_HALT);
221 221
222 chip_id = wl12xx_reg_read32(wl, CHIP_ID_B); 222 chip_id = wl1251_reg_read32(wl, CHIP_ID_B);
223 223
224 wl12xx_debug(DEBUG_BOOT, "chip id after firmware boot: 0x%x", chip_id); 224 wl1251_debug(DEBUG_BOOT, "chip id after firmware boot: 0x%x", chip_id);
225 225
226 if (chip_id != wl->chip.id) { 226 if (chip_id != wl->chip.id) {
227 wl12xx_error("chip id doesn't match after firmware boot"); 227 wl1251_error("chip id doesn't match after firmware boot");
228 return -EIO; 228 return -EIO;
229 } 229 }
230 230
@@ -232,41 +232,41 @@ int wl12xx_boot_run_firmware(struct wl12xx *wl)
232 loop = 0; 232 loop = 0;
233 while (loop++ < INIT_LOOP) { 233 while (loop++ < INIT_LOOP) {
234 udelay(INIT_LOOP_DELAY); 234 udelay(INIT_LOOP_DELAY);
235 interrupt = wl12xx_reg_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR); 235 interrupt = wl1251_reg_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR);
236 236
237 if (interrupt == 0xffffffff) { 237 if (interrupt == 0xffffffff) {
238 wl12xx_error("error reading hardware complete " 238 wl1251_error("error reading hardware complete "
239 "init indication"); 239 "init indication");
240 return -EIO; 240 return -EIO;
241 } 241 }
242 /* check that ACX_INTR_INIT_COMPLETE is enabled */ 242 /* check that ACX_INTR_INIT_COMPLETE is enabled */
243 else if (interrupt & wl->chip.intr_init_complete) { 243 else if (interrupt & wl->chip.intr_init_complete) {
244 wl12xx_reg_write32(wl, ACX_REG_INTERRUPT_ACK, 244 wl1251_reg_write32(wl, ACX_REG_INTERRUPT_ACK,
245 wl->chip.intr_init_complete); 245 wl->chip.intr_init_complete);
246 break; 246 break;
247 } 247 }
248 } 248 }
249 249
250 if (loop >= INIT_LOOP) { 250 if (loop >= INIT_LOOP) {
251 wl12xx_error("timeout waiting for the hardware to " 251 wl1251_error("timeout waiting for the hardware to "
252 "complete initialization"); 252 "complete initialization");
253 return -EIO; 253 return -EIO;
254 } 254 }
255 255
256 /* get hardware config command mail box */ 256 /* get hardware config command mail box */
257 wl->cmd_box_addr = wl12xx_reg_read32(wl, REG_COMMAND_MAILBOX_PTR); 257 wl->cmd_box_addr = wl1251_reg_read32(wl, REG_COMMAND_MAILBOX_PTR);
258 258
259 /* get hardware config event mail box */ 259 /* get hardware config event mail box */
260 wl->event_box_addr = wl12xx_reg_read32(wl, REG_EVENT_MAILBOX_PTR); 260 wl->event_box_addr = wl1251_reg_read32(wl, REG_EVENT_MAILBOX_PTR);
261 261
262 /* set the working partition to its "running" mode offset */ 262 /* set the working partition to its "running" mode offset */
263 wl12xx_set_partition(wl, 263 wl1251_set_partition(wl,
264 wl->chip.p_table[PART_WORK].mem.start, 264 wl->chip.p_table[PART_WORK].mem.start,
265 wl->chip.p_table[PART_WORK].mem.size, 265 wl->chip.p_table[PART_WORK].mem.size,
266 wl->chip.p_table[PART_WORK].reg.start, 266 wl->chip.p_table[PART_WORK].reg.start,
267 wl->chip.p_table[PART_WORK].reg.size); 267 wl->chip.p_table[PART_WORK].reg.size);
268 268
269 wl12xx_debug(DEBUG_MAILBOX, "cmd_box_addr 0x%x event_box_addr 0x%x", 269 wl1251_debug(DEBUG_MAILBOX, "cmd_box_addr 0x%x event_box_addr 0x%x",
270 wl->cmd_box_addr, wl->event_box_addr); 270 wl->cmd_box_addr, wl->event_box_addr);
271 271
272 wl->chip.op_fw_version(wl); 272 wl->chip.op_fw_version(wl);
@@ -277,20 +277,20 @@ int wl12xx_boot_run_firmware(struct wl12xx *wl)
277 */ 277 */
278 278
279 /* enable gpio interrupts */ 279 /* enable gpio interrupts */
280 wl12xx_boot_enable_interrupts(wl); 280 wl1251_boot_enable_interrupts(wl);
281 281
282 wl->chip.op_target_enable_interrupts(wl); 282 wl->chip.op_target_enable_interrupts(wl);
283 283
284 /* unmask all mbox events */ 284 /* unmask all mbox events */
285 wl->event_mask = 0xffffffff; 285 wl->event_mask = 0xffffffff;
286 286
287 ret = wl12xx_event_unmask(wl); 287 ret = wl1251_event_unmask(wl);
288 if (ret < 0) { 288 if (ret < 0) {
289 wl12xx_error("EVENT mask setting failed"); 289 wl1251_error("EVENT mask setting failed");
290 return ret; 290 return ret;
291 } 291 }
292 292
293 wl12xx_event_mbox_config(wl); 293 wl1251_event_mbox_config(wl);
294 294
295 /* firmware startup completed */ 295 /* firmware startup completed */
296 return 0; 296 return 0;
diff --git a/drivers/net/wireless/wl12xx/wl1251_boot.h b/drivers/net/wireless/wl12xx/wl1251_boot.h
index 3e2b7668878..798362d71e3 100644
--- a/drivers/net/wireless/wl12xx/wl1251_boot.h
+++ b/drivers/net/wireless/wl12xx/wl1251_boot.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (C) 2008 Nokia Corporation 4 * Copyright (C) 2008 Nokia Corporation
5 * 5 *
@@ -26,10 +26,10 @@
26 26
27#include "wl1251.h" 27#include "wl1251.h"
28 28
29int wl12xx_boot_soft_reset(struct wl12xx *wl); 29int wl1251_boot_soft_reset(struct wl1251 *wl);
30int wl12xx_boot_init_seq(struct wl12xx *wl); 30int wl1251_boot_init_seq(struct wl1251 *wl);
31int wl12xx_boot_run_firmware(struct wl12xx *wl); 31int wl1251_boot_run_firmware(struct wl1251 *wl);
32void wl12xx_boot_target_enable_interrupts(struct wl12xx *wl); 32void wl1251_boot_target_enable_interrupts(struct wl1251 *wl);
33 33
34/* number of times we try to read the INIT interrupt */ 34/* number of times we try to read the INIT interrupt */
35#define INIT_LOOP 20000 35#define INIT_LOOP 20000
diff --git a/drivers/net/wireless/wl12xx/wl1251_cmd.c b/drivers/net/wireless/wl12xx/wl1251_cmd.c
index 92c7fb6853e..dc04d1fc2ee 100644
--- a/drivers/net/wireless/wl12xx/wl1251_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1251_cmd.c
@@ -5,7 +5,6 @@
5#include <linux/spi/spi.h> 5#include <linux/spi/spi.h>
6 6
7#include "wl1251.h" 7#include "wl1251.h"
8#include "wl12xx_80211.h"
9#include "reg.h" 8#include "reg.h"
10#include "wl1251_spi.h" 9#include "wl1251_spi.h"
11#include "wl1251_ps.h" 10#include "wl1251_ps.h"
@@ -19,9 +18,9 @@
19 * @buf: buffer containing the command, must work with dma 18 * @buf: buffer containing the command, must work with dma
20 * @len: length of the buffer 19 * @len: length of the buffer
21 */ 20 */
22int wl12xx_cmd_send(struct wl12xx *wl, u16 id, void *buf, size_t len) 21int wl1251_cmd_send(struct wl1251 *wl, u16 id, void *buf, size_t len)
23{ 22{
24 struct wl12xx_cmd_header *cmd; 23 struct wl1251_cmd_header *cmd;
25 unsigned long timeout; 24 unsigned long timeout;
26 u32 intr; 25 u32 intr;
27 int ret = 0; 26 int ret = 0;
@@ -32,26 +31,26 @@ int wl12xx_cmd_send(struct wl12xx *wl, u16 id, void *buf, size_t len)
32 31
33 WARN_ON(len % 4 != 0); 32 WARN_ON(len % 4 != 0);
34 33
35 wl12xx_spi_mem_write(wl, wl->cmd_box_addr, buf, len); 34 wl1251_spi_mem_write(wl, wl->cmd_box_addr, buf, len);
36 35
37 wl12xx_reg_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_CMD); 36 wl1251_reg_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_CMD);
38 37
39 timeout = jiffies + msecs_to_jiffies(WL12XX_COMMAND_TIMEOUT); 38 timeout = jiffies + msecs_to_jiffies(WL1251_COMMAND_TIMEOUT);
40 39
41 intr = wl12xx_reg_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR); 40 intr = wl1251_reg_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR);
42 while (!(intr & wl->chip.intr_cmd_complete)) { 41 while (!(intr & wl->chip.intr_cmd_complete)) {
43 if (time_after(jiffies, timeout)) { 42 if (time_after(jiffies, timeout)) {
44 wl12xx_error("command complete timeout"); 43 wl1251_error("command complete timeout");
45 ret = -ETIMEDOUT; 44 ret = -ETIMEDOUT;
46 goto out; 45 goto out;
47 } 46 }
48 47
49 msleep(1); 48 msleep(1);
50 49
51 intr = wl12xx_reg_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR); 50 intr = wl1251_reg_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR);
52 } 51 }
53 52
54 wl12xx_reg_write32(wl, ACX_REG_INTERRUPT_ACK, 53 wl1251_reg_write32(wl, ACX_REG_INTERRUPT_ACK,
55 wl->chip.intr_cmd_complete); 54 wl->chip.intr_cmd_complete);
56 55
57out: 56out:
@@ -66,33 +65,33 @@ out:
66 * @len: length of the buffer 65 * @len: length of the buffer
67 * @answer: is answer needed 66 * @answer: is answer needed
68 */ 67 */
69int wl12xx_cmd_test(struct wl12xx *wl, void *buf, size_t buf_len, u8 answer) 68int wl1251_cmd_test(struct wl1251 *wl, void *buf, size_t buf_len, u8 answer)
70{ 69{
71 int ret; 70 int ret;
72 71
73 wl12xx_debug(DEBUG_CMD, "cmd test"); 72 wl1251_debug(DEBUG_CMD, "cmd test");
74 73
75 ret = wl12xx_cmd_send(wl, CMD_TEST, buf, buf_len); 74 ret = wl1251_cmd_send(wl, CMD_TEST, buf, buf_len);
76 75
77 if (ret < 0) { 76 if (ret < 0) {
78 wl12xx_warning("TEST command failed"); 77 wl1251_warning("TEST command failed");
79 return ret; 78 return ret;
80 } 79 }
81 80
82 if (answer) { 81 if (answer) {
83 struct wl12xx_command *cmd_answer; 82 struct wl1251_command *cmd_answer;
84 83
85 /* 84 /*
86 * The test command got in, we can read the answer. 85 * The test command got in, we can read the answer.
87 * The answer would be a wl12xx_command, where the 86 * The answer would be a wl1251_command, where the
88 * parameter array contains the actual answer. 87 * parameter array contains the actual answer.
89 */ 88 */
90 wl12xx_spi_mem_read(wl, wl->cmd_box_addr, buf, buf_len); 89 wl1251_spi_mem_read(wl, wl->cmd_box_addr, buf, buf_len);
91 90
92 cmd_answer = buf; 91 cmd_answer = buf;
93 92
94 if (cmd_answer->header.status != CMD_STATUS_SUCCESS) 93 if (cmd_answer->header.status != CMD_STATUS_SUCCESS)
95 wl12xx_error("TEST command answer error: %d", 94 wl1251_error("TEST command answer error: %d",
96 cmd_answer->header.status); 95 cmd_answer->header.status);
97 } 96 }
98 97
@@ -107,30 +106,30 @@ int wl12xx_cmd_test(struct wl12xx *wl, void *buf, size_t buf_len, u8 answer)
107 * @buf: buffer for the response, including all headers, must work with dma 106 * @buf: buffer for the response, including all headers, must work with dma
108 * @len: lenght of buf 107 * @len: lenght of buf
109 */ 108 */
110int wl12xx_cmd_interrogate(struct wl12xx *wl, u16 id, void *buf, size_t len) 109int wl1251_cmd_interrogate(struct wl1251 *wl, u16 id, void *buf, size_t len)
111{ 110{
112 struct acx_header *acx = buf; 111 struct acx_header *acx = buf;
113 int ret; 112 int ret;
114 113
115 wl12xx_debug(DEBUG_CMD, "cmd interrogate"); 114 wl1251_debug(DEBUG_CMD, "cmd interrogate");
116 115
117 acx->id = id; 116 acx->id = id;
118 117
119 /* payload length, does not include any headers */ 118 /* payload length, does not include any headers */
120 acx->len = len - sizeof(*acx); 119 acx->len = len - sizeof(*acx);
121 120
122 ret = wl12xx_cmd_send(wl, CMD_INTERROGATE, acx, sizeof(*acx)); 121 ret = wl1251_cmd_send(wl, CMD_INTERROGATE, acx, sizeof(*acx));
123 if (ret < 0) { 122 if (ret < 0) {
124 wl12xx_error("INTERROGATE command failed"); 123 wl1251_error("INTERROGATE command failed");
125 goto out; 124 goto out;
126 } 125 }
127 126
128 /* the interrogate command got in, we can read the answer */ 127 /* the interrogate command got in, we can read the answer */
129 wl12xx_spi_mem_read(wl, wl->cmd_box_addr, buf, len); 128 wl1251_spi_mem_read(wl, wl->cmd_box_addr, buf, len);
130 129
131 acx = buf; 130 acx = buf;
132 if (acx->cmd.status != CMD_STATUS_SUCCESS) 131 if (acx->cmd.status != CMD_STATUS_SUCCESS)
133 wl12xx_error("INTERROGATE command error: %d", 132 wl1251_error("INTERROGATE command error: %d",
134 acx->cmd.status); 133 acx->cmd.status);
135 134
136out: 135out:
@@ -145,34 +144,34 @@ out:
145 * @buf: buffer containing acx, including all headers, must work with dma 144 * @buf: buffer containing acx, including all headers, must work with dma
146 * @len: length of buf 145 * @len: length of buf
147 */ 146 */
148int wl12xx_cmd_configure(struct wl12xx *wl, u16 id, void *buf, size_t len) 147int wl1251_cmd_configure(struct wl1251 *wl, u16 id, void *buf, size_t len)
149{ 148{
150 struct acx_header *acx = buf; 149 struct acx_header *acx = buf;
151 int ret; 150 int ret;
152 151
153 wl12xx_debug(DEBUG_CMD, "cmd configure"); 152 wl1251_debug(DEBUG_CMD, "cmd configure");
154 153
155 acx->id = id; 154 acx->id = id;
156 155
157 /* payload length, does not include any headers */ 156 /* payload length, does not include any headers */
158 acx->len = len - sizeof(*acx); 157 acx->len = len - sizeof(*acx);
159 158
160 ret = wl12xx_cmd_send(wl, CMD_CONFIGURE, acx, len); 159 ret = wl1251_cmd_send(wl, CMD_CONFIGURE, acx, len);
161 if (ret < 0) { 160 if (ret < 0) {
162 wl12xx_warning("CONFIGURE command NOK"); 161 wl1251_warning("CONFIGURE command NOK");
163 return ret; 162 return ret;
164 } 163 }
165 164
166 return 0; 165 return 0;
167} 166}
168 167
169int wl12xx_cmd_vbm(struct wl12xx *wl, u8 identity, 168int wl1251_cmd_vbm(struct wl1251 *wl, u8 identity,
170 void *bitmap, u16 bitmap_len, u8 bitmap_control) 169 void *bitmap, u16 bitmap_len, u8 bitmap_control)
171{ 170{
172 struct wl12xx_cmd_vbm_update *vbm; 171 struct wl1251_cmd_vbm_update *vbm;
173 int ret; 172 int ret;
174 173
175 wl12xx_debug(DEBUG_CMD, "cmd vbm"); 174 wl1251_debug(DEBUG_CMD, "cmd vbm");
176 175
177 vbm = kzalloc(sizeof(*vbm), GFP_KERNEL); 176 vbm = kzalloc(sizeof(*vbm), GFP_KERNEL);
178 if (!vbm) { 177 if (!vbm) {
@@ -183,7 +182,7 @@ int wl12xx_cmd_vbm(struct wl12xx *wl, u8 identity,
183 /* Count and period will be filled by the target */ 182 /* Count and period will be filled by the target */
184 vbm->tim.bitmap_ctrl = bitmap_control; 183 vbm->tim.bitmap_ctrl = bitmap_control;
185 if (bitmap_len > PARTIAL_VBM_MAX) { 184 if (bitmap_len > PARTIAL_VBM_MAX) {
186 wl12xx_warning("cmd vbm len is %d B, truncating to %d", 185 wl1251_warning("cmd vbm len is %d B, truncating to %d",
187 bitmap_len, PARTIAL_VBM_MAX); 186 bitmap_len, PARTIAL_VBM_MAX);
188 bitmap_len = PARTIAL_VBM_MAX; 187 bitmap_len = PARTIAL_VBM_MAX;
189 } 188 }
@@ -193,9 +192,9 @@ int wl12xx_cmd_vbm(struct wl12xx *wl, u8 identity,
193 192
194 vbm->len = cpu_to_le16(bitmap_len + 5); 193 vbm->len = cpu_to_le16(bitmap_len + 5);
195 194
196 ret = wl12xx_cmd_send(wl, CMD_VBM, vbm, sizeof(*vbm)); 195 ret = wl1251_cmd_send(wl, CMD_VBM, vbm, sizeof(*vbm));
197 if (ret < 0) { 196 if (ret < 0) {
198 wl12xx_error("VBM command failed"); 197 wl1251_error("VBM command failed");
199 goto out; 198 goto out;
200 } 199 }
201 200
@@ -204,13 +203,13 @@ out:
204 return 0; 203 return 0;
205} 204}
206 205
207int wl12xx_cmd_data_path(struct wl12xx *wl, u8 channel, bool enable) 206int wl1251_cmd_data_path(struct wl1251 *wl, u8 channel, bool enable)
208{ 207{
209 struct cmd_enabledisable_path *cmd; 208 struct cmd_enabledisable_path *cmd;
210 int ret; 209 int ret;
211 u16 cmd_rx, cmd_tx; 210 u16 cmd_rx, cmd_tx;
212 211
213 wl12xx_debug(DEBUG_CMD, "cmd data path"); 212 wl1251_debug(DEBUG_CMD, "cmd data path");
214 213
215 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); 214 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
216 if (!cmd) { 215 if (!cmd) {
@@ -228,24 +227,24 @@ int wl12xx_cmd_data_path(struct wl12xx *wl, u8 channel, bool enable)
228 cmd_tx = CMD_DISABLE_TX; 227 cmd_tx = CMD_DISABLE_TX;
229 } 228 }
230 229
231 ret = wl12xx_cmd_send(wl, cmd_rx, cmd, sizeof(*cmd)); 230 ret = wl1251_cmd_send(wl, cmd_rx, cmd, sizeof(*cmd));
232 if (ret < 0) { 231 if (ret < 0) {
233 wl12xx_error("rx %s cmd for channel %d failed", 232 wl1251_error("rx %s cmd for channel %d failed",
234 enable ? "start" : "stop", channel); 233 enable ? "start" : "stop", channel);
235 goto out; 234 goto out;
236 } 235 }
237 236
238 wl12xx_debug(DEBUG_BOOT, "rx %s cmd channel %d", 237 wl1251_debug(DEBUG_BOOT, "rx %s cmd channel %d",
239 enable ? "start" : "stop", channel); 238 enable ? "start" : "stop", channel);
240 239
241 ret = wl12xx_cmd_send(wl, cmd_tx, cmd, sizeof(*cmd)); 240 ret = wl1251_cmd_send(wl, cmd_tx, cmd, sizeof(*cmd));
242 if (ret < 0) { 241 if (ret < 0) {
243 wl12xx_error("tx %s cmd for channel %d failed", 242 wl1251_error("tx %s cmd for channel %d failed",
244 enable ? "start" : "stop", channel); 243 enable ? "start" : "stop", channel);
245 return ret; 244 return ret;
246 } 245 }
247 246
248 wl12xx_debug(DEBUG_BOOT, "tx %s cmd channel %d", 247 wl1251_debug(DEBUG_BOOT, "tx %s cmd channel %d",
249 enable ? "start" : "stop", channel); 248 enable ? "start" : "stop", channel);
250 249
251out: 250out:
@@ -253,7 +252,7 @@ out:
253 return ret; 252 return ret;
254} 253}
255 254
256int wl1251_cmd_join(struct wl12xx *wl, u8 bss_type, u8 dtim_interval, 255int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 dtim_interval,
257 u16 beacon_interval, u8 wait) 256 u16 beacon_interval, u8 wait)
258{ 257{
259 unsigned long timeout; 258 unsigned long timeout;
@@ -268,14 +267,14 @@ int wl1251_cmd_join(struct wl12xx *wl, u8 bss_type, u8 dtim_interval,
268 } 267 }
269 268
270 /* FIXME: this should be in main.c */ 269 /* FIXME: this should be in main.c */
271 ret = wl12xx_acx_frame_rates(wl, DEFAULT_HW_GEN_TX_RATE, 270 ret = wl1251_acx_frame_rates(wl, DEFAULT_HW_GEN_TX_RATE,
272 DEFAULT_HW_GEN_MODULATION_TYPE, 271 DEFAULT_HW_GEN_MODULATION_TYPE,
273 wl->tx_mgmt_frm_rate, 272 wl->tx_mgmt_frm_rate,
274 wl->tx_mgmt_frm_mod); 273 wl->tx_mgmt_frm_mod);
275 if (ret < 0) 274 if (ret < 0)
276 goto out; 275 goto out;
277 276
278 wl12xx_debug(DEBUG_CMD, "cmd join"); 277 wl1251_debug(DEBUG_CMD, "cmd join");
279 278
280 /* Reverse order BSSID */ 279 /* Reverse order BSSID */
281 bssid = (u8 *) &join->bssid_lsb; 280 bssid = (u8 *) &join->bssid_lsb;
@@ -294,9 +293,9 @@ int wl1251_cmd_join(struct wl12xx *wl, u8 bss_type, u8 dtim_interval,
294 join->channel = wl->channel; 293 join->channel = wl->channel;
295 join->ctrl = JOIN_CMD_CTRL_TX_FLUSH; 294 join->ctrl = JOIN_CMD_CTRL_TX_FLUSH;
296 295
297 ret = wl12xx_cmd_send(wl, CMD_START_JOIN, join, sizeof(*join)); 296 ret = wl1251_cmd_send(wl, CMD_START_JOIN, join, sizeof(*join));
298 if (ret < 0) { 297 if (ret < 0) {
299 wl12xx_error("failed to initiate cmd join"); 298 wl1251_error("failed to initiate cmd join");
300 goto out; 299 goto out;
301 } 300 }
302 301
@@ -314,20 +313,20 @@ out:
314 return ret; 313 return ret;
315} 314}
316 315
317int wl12xx_cmd_ps_mode(struct wl12xx *wl, u8 ps_mode) 316int wl1251_cmd_ps_mode(struct wl1251 *wl, u8 ps_mode)
318{ 317{
319 struct wl12xx_cmd_ps_params *ps_params = NULL; 318 struct wl1251_cmd_ps_params *ps_params = NULL;
320 int ret = 0; 319 int ret = 0;
321 320
322 /* FIXME: this should be in ps.c */ 321 /* FIXME: this should be in ps.c */
323 ret = wl12xx_acx_wake_up_conditions(wl, WAKE_UP_EVENT_DTIM_BITMAP, 322 ret = wl1251_acx_wake_up_conditions(wl, WAKE_UP_EVENT_DTIM_BITMAP,
324 wl->listen_int); 323 wl->listen_int);
325 if (ret < 0) { 324 if (ret < 0) {
326 wl12xx_error("couldn't set wake up conditions"); 325 wl1251_error("couldn't set wake up conditions");
327 goto out; 326 goto out;
328 } 327 }
329 328
330 wl12xx_debug(DEBUG_CMD, "cmd set ps mode"); 329 wl1251_debug(DEBUG_CMD, "cmd set ps mode");
331 330
332 ps_params = kzalloc(sizeof(*ps_params), GFP_KERNEL); 331 ps_params = kzalloc(sizeof(*ps_params), GFP_KERNEL);
333 if (!ps_params) { 332 if (!ps_params) {
@@ -341,10 +340,10 @@ int wl12xx_cmd_ps_mode(struct wl12xx *wl, u8 ps_mode)
341 ps_params->hang_over_period = 128; 340 ps_params->hang_over_period = 128;
342 ps_params->null_data_rate = 1; /* 1 Mbps */ 341 ps_params->null_data_rate = 1; /* 1 Mbps */
343 342
344 ret = wl12xx_cmd_send(wl, CMD_SET_PS_MODE, ps_params, 343 ret = wl1251_cmd_send(wl, CMD_SET_PS_MODE, ps_params,
345 sizeof(*ps_params)); 344 sizeof(*ps_params));
346 if (ret < 0) { 345 if (ret < 0) {
347 wl12xx_error("cmd set_ps_mode failed"); 346 wl1251_error("cmd set_ps_mode failed");
348 goto out; 347 goto out;
349 } 348 }
350 349
@@ -353,13 +352,13 @@ out:
353 return ret; 352 return ret;
354} 353}
355 354
356int wl12xx_cmd_read_memory(struct wl12xx *wl, u32 addr, void *answer, 355int wl1251_cmd_read_memory(struct wl1251 *wl, u32 addr, void *answer,
357 size_t len) 356 size_t len)
358{ 357{
359 struct cmd_read_write_memory *cmd; 358 struct cmd_read_write_memory *cmd;
360 int ret = 0; 359 int ret = 0;
361 360
362 wl12xx_debug(DEBUG_CMD, "cmd read memory"); 361 wl1251_debug(DEBUG_CMD, "cmd read memory");
363 362
364 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); 363 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
365 if (!cmd) { 364 if (!cmd) {
@@ -373,17 +372,17 @@ int wl12xx_cmd_read_memory(struct wl12xx *wl, u32 addr, void *answer,
373 cmd->addr = addr; 372 cmd->addr = addr;
374 cmd->size = len; 373 cmd->size = len;
375 374
376 ret = wl12xx_cmd_send(wl, CMD_READ_MEMORY, cmd, sizeof(*cmd)); 375 ret = wl1251_cmd_send(wl, CMD_READ_MEMORY, cmd, sizeof(*cmd));
377 if (ret < 0) { 376 if (ret < 0) {
378 wl12xx_error("read memory command failed: %d", ret); 377 wl1251_error("read memory command failed: %d", ret);
379 goto out; 378 goto out;
380 } 379 }
381 380
382 /* the read command got in, we can now read the answer */ 381 /* the read command got in, we can now read the answer */
383 wl12xx_spi_mem_read(wl, wl->cmd_box_addr, cmd, sizeof(*cmd)); 382 wl1251_spi_mem_read(wl, wl->cmd_box_addr, cmd, sizeof(*cmd));
384 383
385 if (cmd->header.status != CMD_STATUS_SUCCESS) 384 if (cmd->header.status != CMD_STATUS_SUCCESS)
386 wl12xx_error("error in read command result: %d", 385 wl1251_error("error in read command result: %d",
387 cmd->header.status); 386 cmd->header.status);
388 387
389 memcpy(answer, cmd->value, len); 388 memcpy(answer, cmd->value, len);
@@ -393,17 +392,17 @@ out:
393 return ret; 392 return ret;
394} 393}
395 394
396int wl12xx_cmd_template_set(struct wl12xx *wl, u16 cmd_id, 395int wl1251_cmd_template_set(struct wl1251 *wl, u16 cmd_id,
397 void *buf, size_t buf_len) 396 void *buf, size_t buf_len)
398{ 397{
399 struct wl12xx_cmd_packet_template *cmd; 398 struct wl1251_cmd_packet_template *cmd;
400 size_t cmd_len; 399 size_t cmd_len;
401 int ret = 0; 400 int ret = 0;
402 401
403 wl12xx_debug(DEBUG_CMD, "cmd template %d", cmd_id); 402 wl1251_debug(DEBUG_CMD, "cmd template %d", cmd_id);
404 403
405 WARN_ON(buf_len > WL12XX_MAX_TEMPLATE_SIZE); 404 WARN_ON(buf_len > WL1251_MAX_TEMPLATE_SIZE);
406 buf_len = min_t(size_t, buf_len, WL12XX_MAX_TEMPLATE_SIZE); 405 buf_len = min_t(size_t, buf_len, WL1251_MAX_TEMPLATE_SIZE);
407 cmd_len = ALIGN(sizeof(*cmd) + buf_len, 4); 406 cmd_len = ALIGN(sizeof(*cmd) + buf_len, 4);
408 407
409 cmd = kzalloc(cmd_len, GFP_KERNEL); 408 cmd = kzalloc(cmd_len, GFP_KERNEL);
@@ -417,9 +416,9 @@ int wl12xx_cmd_template_set(struct wl12xx *wl, u16 cmd_id,
417 if (buf) 416 if (buf)
418 memcpy(cmd->data, buf, buf_len); 417 memcpy(cmd->data, buf, buf_len);
419 418
420 ret = wl12xx_cmd_send(wl, cmd_id, cmd, cmd_len); 419 ret = wl1251_cmd_send(wl, cmd_id, cmd, cmd_len);
421 if (ret < 0) { 420 if (ret < 0) {
422 wl12xx_warning("cmd set_template failed: %d", ret); 421 wl1251_warning("cmd set_template failed: %d", ret);
423 goto out; 422 goto out;
424 } 423 }
425 424
diff --git a/drivers/net/wireless/wl12xx/wl1251_cmd.h b/drivers/net/wireless/wl12xx/wl1251_cmd.h
index b252ad25ee2..64f228dd9a9 100644
--- a/drivers/net/wireless/wl12xx/wl1251_cmd.h
+++ b/drivers/net/wireless/wl12xx/wl1251_cmd.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (c) 1998-2007 Texas Instruments Incorporated 4 * Copyright (c) 1998-2007 Texas Instruments Incorporated
5 * Copyright (C) 2008 Nokia Corporation 5 * Copyright (C) 2008 Nokia Corporation
@@ -22,32 +22,32 @@
22 * 22 *
23 */ 23 */
24 24
25#ifndef __WL12XX_CMD_H__ 25#ifndef __WL1251_CMD_H__
26#define __WL12XX_CMD_H__ 26#define __WL1251_CMD_H__
27 27
28#include "wl1251.h" 28#include "wl1251.h"
29 29
30struct acx_header; 30struct acx_header;
31 31
32int wl12xx_cmd_send(struct wl12xx *wl, u16 type, void *buf, size_t buf_len); 32int wl1251_cmd_send(struct wl1251 *wl, u16 type, void *buf, size_t buf_len);
33int wl12xx_cmd_test(struct wl12xx *wl, void *buf, size_t buf_len, u8 answer); 33int wl1251_cmd_test(struct wl1251 *wl, void *buf, size_t buf_len, u8 answer);
34int wl12xx_cmd_interrogate(struct wl12xx *wl, u16 id, void *buf, size_t len); 34int wl1251_cmd_interrogate(struct wl1251 *wl, u16 id, void *buf, size_t len);
35int wl12xx_cmd_configure(struct wl12xx *wl, u16 id, void *buf, size_t len); 35int wl1251_cmd_configure(struct wl1251 *wl, u16 id, void *buf, size_t len);
36int wl12xx_cmd_vbm(struct wl12xx *wl, u8 identity, 36int wl1251_cmd_vbm(struct wl1251 *wl, u8 identity,
37 void *bitmap, u16 bitmap_len, u8 bitmap_control); 37 void *bitmap, u16 bitmap_len, u8 bitmap_control);
38int wl12xx_cmd_data_path(struct wl12xx *wl, u8 channel, bool enable); 38int wl1251_cmd_data_path(struct wl1251 *wl, u8 channel, bool enable);
39int wl1251_cmd_join(struct wl12xx *wl, u8 bss_type, u8 dtim_interval, 39int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 dtim_interval,
40 u16 beacon_interval, u8 wait); 40 u16 beacon_interval, u8 wait);
41int wl12xx_cmd_ps_mode(struct wl12xx *wl, u8 ps_mode); 41int wl1251_cmd_ps_mode(struct wl1251 *wl, u8 ps_mode);
42int wl12xx_cmd_read_memory(struct wl12xx *wl, u32 addr, void *answer, 42int wl1251_cmd_read_memory(struct wl1251 *wl, u32 addr, void *answer,
43 size_t len); 43 size_t len);
44int wl12xx_cmd_template_set(struct wl12xx *wl, u16 cmd_id, 44int wl1251_cmd_template_set(struct wl1251 *wl, u16 cmd_id,
45 void *buf, size_t buf_len); 45 void *buf, size_t buf_len);
46 46
47/* unit ms */ 47/* unit ms */
48#define WL12XX_COMMAND_TIMEOUT 2000 48#define WL1251_COMMAND_TIMEOUT 2000
49 49
50enum wl12xx_commands { 50enum wl1251_commands {
51 CMD_RESET = 0, 51 CMD_RESET = 0,
52 CMD_INTERROGATE = 1, /*use this to read information elements*/ 52 CMD_INTERROGATE = 1, /*use this to read information elements*/
53 CMD_CONFIGURE = 2, /*use this to write information elements*/ 53 CMD_CONFIGURE = 2, /*use this to write information elements*/
@@ -95,15 +95,15 @@ enum wl12xx_commands {
95 95
96#define MAX_CMD_PARAMS 572 96#define MAX_CMD_PARAMS 572
97 97
98struct wl12xx_cmd_header { 98struct wl1251_cmd_header {
99 u16 id; 99 u16 id;
100 u16 status; 100 u16 status;
101 /* payload */ 101 /* payload */
102 u8 data[0]; 102 u8 data[0];
103} __attribute__ ((packed)); 103} __attribute__ ((packed));
104 104
105struct wl12xx_command { 105struct wl1251_command {
106 struct wl12xx_cmd_header header; 106 struct wl1251_cmd_header header;
107 u8 parameters[MAX_CMD_PARAMS]; 107 u8 parameters[MAX_CMD_PARAMS];
108}; 108};
109 109
@@ -145,7 +145,7 @@ enum {
145#define MAX_READ_SIZE 256 145#define MAX_READ_SIZE 256
146 146
147struct cmd_read_write_memory { 147struct cmd_read_write_memory {
148 struct wl12xx_cmd_header header; 148 struct wl1251_cmd_header header;
149 149
150 /* The address of the memory to read from or write to.*/ 150 /* The address of the memory to read from or write to.*/
151 u32 addr; 151 u32 addr;
@@ -214,7 +214,7 @@ struct basic_scan_channel_parameters {
214#define SCAN_MAX_NUM_OF_CHANNELS 16 214#define SCAN_MAX_NUM_OF_CHANNELS 16
215 215
216struct cmd_scan { 216struct cmd_scan {
217 struct wl12xx_cmd_header header; 217 struct wl1251_cmd_header header;
218 218
219 struct basic_scan_parameters params; 219 struct basic_scan_parameters params;
220 struct basic_scan_channel_parameters channels[SCAN_MAX_NUM_OF_CHANNELS]; 220 struct basic_scan_channel_parameters channels[SCAN_MAX_NUM_OF_CHANNELS];
@@ -232,7 +232,7 @@ enum {
232 232
233 233
234struct cmd_join { 234struct cmd_join {
235 struct wl12xx_cmd_header header; 235 struct wl1251_cmd_header header;
236 236
237 u32 bssid_lsb; 237 u32 bssid_lsb;
238 u16 bssid_msb; 238 u16 bssid_msb;
@@ -269,16 +269,16 @@ struct cmd_join {
269} __attribute__ ((packed)); 269} __attribute__ ((packed));
270 270
271struct cmd_enabledisable_path { 271struct cmd_enabledisable_path {
272 struct wl12xx_cmd_header header; 272 struct wl1251_cmd_header header;
273 273
274 u8 channel; 274 u8 channel;
275 u8 padding[3]; 275 u8 padding[3];
276} __attribute__ ((packed)); 276} __attribute__ ((packed));
277 277
278#define WL12XX_MAX_TEMPLATE_SIZE 300 278#define WL1251_MAX_TEMPLATE_SIZE 300
279 279
280struct wl12xx_cmd_packet_template { 280struct wl1251_cmd_packet_template {
281 struct wl12xx_cmd_header header; 281 struct wl1251_cmd_header header;
282 282
283 __le16 size; 283 __le16 size;
284 u8 data[0]; 284 u8 data[0];
@@ -287,7 +287,7 @@ struct wl12xx_cmd_packet_template {
287#define TIM_ELE_ID 5 287#define TIM_ELE_ID 5
288#define PARTIAL_VBM_MAX 251 288#define PARTIAL_VBM_MAX 251
289 289
290struct wl12xx_tim { 290struct wl1251_tim {
291 u8 identity; 291 u8 identity;
292 u8 length; 292 u8 length;
293 u8 dtim_count; 293 u8 dtim_count;
@@ -297,20 +297,20 @@ struct wl12xx_tim {
297} __attribute__ ((packed)); 297} __attribute__ ((packed));
298 298
299/* Virtual Bit Map update */ 299/* Virtual Bit Map update */
300struct wl12xx_cmd_vbm_update { 300struct wl1251_cmd_vbm_update {
301 struct wl12xx_cmd_header header; 301 struct wl1251_cmd_header header;
302 __le16 len; 302 __le16 len;
303 u8 padding[2]; 303 u8 padding[2];
304 struct wl12xx_tim tim; 304 struct wl1251_tim tim;
305} __attribute__ ((packed)); 305} __attribute__ ((packed));
306 306
307enum wl12xx_cmd_ps_mode { 307enum wl1251_cmd_ps_mode {
308 STATION_ACTIVE_MODE, 308 STATION_ACTIVE_MODE,
309 STATION_POWER_SAVE_MODE 309 STATION_POWER_SAVE_MODE
310}; 310};
311 311
312struct wl12xx_cmd_ps_params { 312struct wl1251_cmd_ps_params {
313 struct wl12xx_cmd_header header; 313 struct wl1251_cmd_header header;
314 314
315 u8 ps_mode; /* STATION_* */ 315 u8 ps_mode; /* STATION_* */
316 u8 send_null_data; /* Do we have to send NULL data packet ? */ 316 u8 send_null_data; /* Do we have to send NULL data packet ? */
@@ -325,8 +325,8 @@ struct wl12xx_cmd_ps_params {
325 u8 pad[2]; 325 u8 pad[2];
326} __attribute__ ((packed)); 326} __attribute__ ((packed));
327 327
328struct wl12xx_cmd_trigger_scan_to { 328struct wl1251_cmd_trigger_scan_to {
329 struct wl12xx_cmd_header header; 329 struct wl1251_cmd_header header;
330 330
331 u32 timeout; 331 u32 timeout;
332}; 332};
@@ -340,14 +340,14 @@ struct wl12xx_cmd_trigger_scan_to {
340/* When set, disable HW decryption */ 340/* When set, disable HW decryption */
341#define DF_SNIFF_MODE_ENABLE 0x80 341#define DF_SNIFF_MODE_ENABLE 0x80
342 342
343enum wl12xx_cmd_key_action { 343enum wl1251_cmd_key_action {
344 KEY_ADD_OR_REPLACE = 1, 344 KEY_ADD_OR_REPLACE = 1,
345 KEY_REMOVE = 2, 345 KEY_REMOVE = 2,
346 KEY_SET_ID = 3, 346 KEY_SET_ID = 3,
347 MAX_KEY_ACTION = 0xffff, 347 MAX_KEY_ACTION = 0xffff,
348}; 348};
349 349
350enum wl12xx_cmd_key_type { 350enum wl1251_cmd_key_type {
351 KEY_WEP_DEFAULT = 0, 351 KEY_WEP_DEFAULT = 0,
352 KEY_WEP_ADDR = 1, 352 KEY_WEP_ADDR = 1,
353 KEY_AES_GROUP = 4, 353 KEY_AES_GROUP = 4,
@@ -374,8 +374,8 @@ enum wl12xx_cmd_key_type {
374 * 374 *
375 */ 375 */
376 376
377struct wl12xx_cmd_set_keys { 377struct wl1251_cmd_set_keys {
378 struct wl12xx_cmd_header header; 378 struct wl1251_cmd_header header;
379 379
380 /* Ignored for default WEP key */ 380 /* Ignored for default WEP key */
381 u8 addr[ETH_ALEN]; 381 u8 addr[ETH_ALEN];
@@ -404,4 +404,4 @@ struct wl12xx_cmd_set_keys {
404} __attribute__ ((packed)); 404} __attribute__ ((packed));
405 405
406 406
407#endif /* __WL12XX_CMD_H__ */ 407#endif /* __WL1251_CMD_H__ */
diff --git a/drivers/net/wireless/wl12xx/wl1251_debugfs.c b/drivers/net/wireless/wl12xx/wl1251_debugfs.c
index 866303dd687..a00723059f8 100644
--- a/drivers/net/wireless/wl12xx/wl1251_debugfs.c
+++ b/drivers/net/wireless/wl12xx/wl1251_debugfs.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (C) 2009 Nokia Corporation 4 * Copyright (C) 2009 Nokia Corporation
5 * 5 *
@@ -30,7 +30,7 @@
30#include "wl1251_ps.h" 30#include "wl1251_ps.h"
31 31
32/* ms */ 32/* ms */
33#define WL12XX_DEBUGFS_STATS_LIFETIME 1000 33#define WL1251_DEBUGFS_STATS_LIFETIME 1000
34 34
35/* debugfs macros idea from mac80211 */ 35/* debugfs macros idea from mac80211 */
36 36
@@ -38,7 +38,7 @@
38static ssize_t name## _read(struct file *file, char __user *userbuf, \ 38static ssize_t name## _read(struct file *file, char __user *userbuf, \
39 size_t count, loff_t *ppos) \ 39 size_t count, loff_t *ppos) \
40{ \ 40{ \
41 struct wl12xx *wl = file->private_data; \ 41 struct wl1251 *wl = file->private_data; \
42 char buf[buflen]; \ 42 char buf[buflen]; \
43 int res; \ 43 int res; \
44 \ 44 \
@@ -48,7 +48,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \
48 \ 48 \
49static const struct file_operations name## _ops = { \ 49static const struct file_operations name## _ops = { \
50 .read = name## _read, \ 50 .read = name## _read, \
51 .open = wl12xx_open_file_generic, \ 51 .open = wl1251_open_file_generic, \
52}; 52};
53 53
54#define DEBUGFS_ADD(name, parent) \ 54#define DEBUGFS_ADD(name, parent) \
@@ -71,11 +71,11 @@ static ssize_t sub## _ ##name## _read(struct file *file, \
71 char __user *userbuf, \ 71 char __user *userbuf, \
72 size_t count, loff_t *ppos) \ 72 size_t count, loff_t *ppos) \
73{ \ 73{ \
74 struct wl12xx *wl = file->private_data; \ 74 struct wl1251 *wl = file->private_data; \
75 char buf[buflen]; \ 75 char buf[buflen]; \
76 int res; \ 76 int res; \
77 \ 77 \
78 wl12xx_debugfs_update_stats(wl); \ 78 wl1251_debugfs_update_stats(wl); \
79 \ 79 \
80 res = scnprintf(buf, buflen, fmt "\n", \ 80 res = scnprintf(buf, buflen, fmt "\n", \
81 wl->stats.fw_stats->sub.name); \ 81 wl->stats.fw_stats->sub.name); \
@@ -84,7 +84,7 @@ static ssize_t sub## _ ##name## _read(struct file *file, \
84 \ 84 \
85static const struct file_operations sub## _ ##name## _ops = { \ 85static const struct file_operations sub## _ ##name## _ops = { \
86 .read = sub## _ ##name## _read, \ 86 .read = sub## _ ##name## _read, \
87 .open = wl12xx_open_file_generic, \ 87 .open = wl1251_open_file_generic, \
88}; 88};
89 89
90#define DEBUGFS_FWSTATS_ADD(sub, name) \ 90#define DEBUGFS_FWSTATS_ADD(sub, name) \
@@ -93,30 +93,30 @@ static const struct file_operations sub## _ ##name## _ops = { \
93#define DEBUGFS_FWSTATS_DEL(sub, name) \ 93#define DEBUGFS_FWSTATS_DEL(sub, name) \
94 DEBUGFS_DEL(sub## _ ##name) 94 DEBUGFS_DEL(sub## _ ##name)
95 95
96static void wl12xx_debugfs_update_stats(struct wl12xx *wl) 96static void wl1251_debugfs_update_stats(struct wl1251 *wl)
97{ 97{
98 int ret; 98 int ret;
99 99
100 mutex_lock(&wl->mutex); 100 mutex_lock(&wl->mutex);
101 101
102 ret = wl12xx_ps_elp_wakeup(wl); 102 ret = wl1251_ps_elp_wakeup(wl);
103 if (ret < 0) 103 if (ret < 0)
104 goto out; 104 goto out;
105 105
106 if (wl->state == WL12XX_STATE_ON && 106 if (wl->state == WL1251_STATE_ON &&
107 time_after(jiffies, wl->stats.fw_stats_update + 107 time_after(jiffies, wl->stats.fw_stats_update +
108 msecs_to_jiffies(WL12XX_DEBUGFS_STATS_LIFETIME))) { 108 msecs_to_jiffies(WL1251_DEBUGFS_STATS_LIFETIME))) {
109 wl12xx_acx_statistics(wl, wl->stats.fw_stats); 109 wl1251_acx_statistics(wl, wl->stats.fw_stats);
110 wl->stats.fw_stats_update = jiffies; 110 wl->stats.fw_stats_update = jiffies;
111 } 111 }
112 112
113 wl12xx_ps_elp_sleep(wl); 113 wl1251_ps_elp_sleep(wl);
114 114
115out: 115out:
116 mutex_unlock(&wl->mutex); 116 mutex_unlock(&wl->mutex);
117} 117}
118 118
119static int wl12xx_open_file_generic(struct inode *inode, struct file *file) 119static int wl1251_open_file_generic(struct inode *inode, struct file *file)
120{ 120{
121 file->private_data = inode->i_private; 121 file->private_data = inode->i_private;
122 return 0; 122 return 0;
@@ -221,7 +221,7 @@ DEBUGFS_READONLY_FILE(excessive_retries, 20, "%u",
221static ssize_t tx_queue_len_read(struct file *file, char __user *userbuf, 221static ssize_t tx_queue_len_read(struct file *file, char __user *userbuf,
222 size_t count, loff_t *ppos) 222 size_t count, loff_t *ppos)
223{ 223{
224 struct wl12xx *wl = file->private_data; 224 struct wl1251 *wl = file->private_data;
225 u32 queue_len; 225 u32 queue_len;
226 char buf[20]; 226 char buf[20];
227 int res; 227 int res;
@@ -234,10 +234,10 @@ static ssize_t tx_queue_len_read(struct file *file, char __user *userbuf,
234 234
235static const struct file_operations tx_queue_len_ops = { 235static const struct file_operations tx_queue_len_ops = {
236 .read = tx_queue_len_read, 236 .read = tx_queue_len_read,
237 .open = wl12xx_open_file_generic, 237 .open = wl1251_open_file_generic,
238}; 238};
239 239
240static void wl12xx_debugfs_delete_files(struct wl12xx *wl) 240static void wl1251_debugfs_delete_files(struct wl1251 *wl)
241{ 241{
242 DEBUGFS_FWSTATS_DEL(tx, internal_desc_overflow); 242 DEBUGFS_FWSTATS_DEL(tx, internal_desc_overflow);
243 243
@@ -335,7 +335,7 @@ static void wl12xx_debugfs_delete_files(struct wl12xx *wl)
335 DEBUGFS_DEL(excessive_retries); 335 DEBUGFS_DEL(excessive_retries);
336} 336}
337 337
338static int wl12xx_debugfs_add_files(struct wl12xx *wl) 338static int wl1251_debugfs_add_files(struct wl1251 *wl)
339{ 339{
340 int ret = 0; 340 int ret = 0;
341 341
@@ -436,19 +436,19 @@ static int wl12xx_debugfs_add_files(struct wl12xx *wl)
436 436
437out: 437out:
438 if (ret < 0) 438 if (ret < 0)
439 wl12xx_debugfs_delete_files(wl); 439 wl1251_debugfs_delete_files(wl);
440 440
441 return ret; 441 return ret;
442} 442}
443 443
444void wl12xx_debugfs_reset(struct wl12xx *wl) 444void wl1251_debugfs_reset(struct wl1251 *wl)
445{ 445{
446 memset(wl->stats.fw_stats, 0, sizeof(*wl->stats.fw_stats)); 446 memset(wl->stats.fw_stats, 0, sizeof(*wl->stats.fw_stats));
447 wl->stats.retry_count = 0; 447 wl->stats.retry_count = 0;
448 wl->stats.excessive_retries = 0; 448 wl->stats.excessive_retries = 0;
449} 449}
450 450
451int wl12xx_debugfs_init(struct wl12xx *wl) 451int wl1251_debugfs_init(struct wl1251 *wl)
452{ 452{
453 int ret; 453 int ret;
454 454
@@ -479,7 +479,7 @@ int wl12xx_debugfs_init(struct wl12xx *wl)
479 479
480 wl->stats.fw_stats_update = jiffies; 480 wl->stats.fw_stats_update = jiffies;
481 481
482 ret = wl12xx_debugfs_add_files(wl); 482 ret = wl1251_debugfs_add_files(wl);
483 483
484 if (ret < 0) 484 if (ret < 0)
485 goto err_file; 485 goto err_file;
@@ -502,9 +502,9 @@ err:
502 return ret; 502 return ret;
503} 503}
504 504
505void wl12xx_debugfs_exit(struct wl12xx *wl) 505void wl1251_debugfs_exit(struct wl1251 *wl)
506{ 506{
507 wl12xx_debugfs_delete_files(wl); 507 wl1251_debugfs_delete_files(wl);
508 508
509 kfree(wl->stats.fw_stats); 509 kfree(wl->stats.fw_stats);
510 wl->stats.fw_stats = NULL; 510 wl->stats.fw_stats = NULL;
diff --git a/drivers/net/wireless/wl12xx/wl1251_debugfs.h b/drivers/net/wireless/wl12xx/wl1251_debugfs.h
index 37653eb0cd0..6dc3d080853 100644
--- a/drivers/net/wireless/wl12xx/wl1251_debugfs.h
+++ b/drivers/net/wireless/wl12xx/wl1251_debugfs.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (C) 2009 Nokia Corporation 4 * Copyright (C) 2009 Nokia Corporation
5 * 5 *
@@ -21,13 +21,13 @@
21 * 21 *
22 */ 22 */
23 23
24#ifndef WL12XX_DEBUGFS_H 24#ifndef WL1251_DEBUGFS_H
25#define WL12XX_DEBUGFS_H 25#define WL1251_DEBUGFS_H
26 26
27#include "wl1251.h" 27#include "wl1251.h"
28 28
29int wl12xx_debugfs_init(struct wl12xx *wl); 29int wl1251_debugfs_init(struct wl1251 *wl);
30void wl12xx_debugfs_exit(struct wl12xx *wl); 30void wl1251_debugfs_exit(struct wl1251 *wl);
31void wl12xx_debugfs_reset(struct wl12xx *wl); 31void wl1251_debugfs_reset(struct wl1251 *wl);
32 32
33#endif /* WL12XX_DEBUGFS_H */ 33#endif /* WL1251_DEBUGFS_H */
diff --git a/drivers/net/wireless/wl12xx/wl1251_event.c b/drivers/net/wireless/wl12xx/wl1251_event.c
index a6d92349add..1a0a0bc1a31 100644
--- a/drivers/net/wireless/wl12xx/wl1251_event.c
+++ b/drivers/net/wireless/wl12xx/wl1251_event.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (c) 1998-2007 Texas Instruments Incorporated 4 * Copyright (c) 1998-2007 Texas Instruments Incorporated
5 * Copyright (C) 2008 Nokia Corporation 5 * Copyright (C) 2008 Nokia Corporation
@@ -28,10 +28,10 @@
28#include "wl1251_event.h" 28#include "wl1251_event.h"
29#include "wl1251_ps.h" 29#include "wl1251_ps.h"
30 30
31static int wl12xx_event_scan_complete(struct wl12xx *wl, 31static int wl1251_event_scan_complete(struct wl1251 *wl,
32 struct event_mailbox *mbox) 32 struct event_mailbox *mbox)
33{ 33{
34 wl12xx_debug(DEBUG_EVENT, "status: 0x%x, channels: %d", 34 wl1251_debug(DEBUG_EVENT, "status: 0x%x, channels: %d",
35 mbox->scheduled_scan_status, 35 mbox->scheduled_scan_status,
36 mbox->scheduled_scan_channels); 36 mbox->scheduled_scan_channels);
37 37
@@ -45,34 +45,34 @@ static int wl12xx_event_scan_complete(struct wl12xx *wl,
45 return 0; 45 return 0;
46} 46}
47 47
48static void wl12xx_event_mbox_dump(struct event_mailbox *mbox) 48static void wl1251_event_mbox_dump(struct event_mailbox *mbox)
49{ 49{
50 wl12xx_debug(DEBUG_EVENT, "MBOX DUMP:"); 50 wl1251_debug(DEBUG_EVENT, "MBOX DUMP:");
51 wl12xx_debug(DEBUG_EVENT, "\tvector: 0x%x", mbox->events_vector); 51 wl1251_debug(DEBUG_EVENT, "\tvector: 0x%x", mbox->events_vector);
52 wl12xx_debug(DEBUG_EVENT, "\tmask: 0x%x", mbox->events_mask); 52 wl1251_debug(DEBUG_EVENT, "\tmask: 0x%x", mbox->events_mask);
53} 53}
54 54
55static int wl12xx_event_process(struct wl12xx *wl, struct event_mailbox *mbox) 55static int wl1251_event_process(struct wl1251 *wl, struct event_mailbox *mbox)
56{ 56{
57 int ret; 57 int ret;
58 u32 vector; 58 u32 vector;
59 59
60 wl12xx_event_mbox_dump(mbox); 60 wl1251_event_mbox_dump(mbox);
61 61
62 vector = mbox->events_vector & ~(mbox->events_mask); 62 vector = mbox->events_vector & ~(mbox->events_mask);
63 wl12xx_debug(DEBUG_EVENT, "vector: 0x%x", vector); 63 wl1251_debug(DEBUG_EVENT, "vector: 0x%x", vector);
64 64
65 if (vector & SCAN_COMPLETE_EVENT_ID) { 65 if (vector & SCAN_COMPLETE_EVENT_ID) {
66 ret = wl12xx_event_scan_complete(wl, mbox); 66 ret = wl1251_event_scan_complete(wl, mbox);
67 if (ret < 0) 67 if (ret < 0)
68 return ret; 68 return ret;
69 } 69 }
70 70
71 if (vector & BSS_LOSE_EVENT_ID) { 71 if (vector & BSS_LOSE_EVENT_ID) {
72 wl12xx_debug(DEBUG_EVENT, "BSS_LOSE_EVENT"); 72 wl1251_debug(DEBUG_EVENT, "BSS_LOSE_EVENT");
73 73
74 if (wl->psm_requested && wl->psm) { 74 if (wl->psm_requested && wl->psm) {
75 ret = wl12xx_ps_set_mode(wl, STATION_ACTIVE_MODE); 75 ret = wl1251_ps_set_mode(wl, STATION_ACTIVE_MODE);
76 if (ret < 0) 76 if (ret < 0)
77 return ret; 77 return ret;
78 } 78 }
@@ -81,47 +81,47 @@ static int wl12xx_event_process(struct wl12xx *wl, struct event_mailbox *mbox)
81 return 0; 81 return 0;
82} 82}
83 83
84int wl12xx_event_unmask(struct wl12xx *wl) 84int wl1251_event_unmask(struct wl1251 *wl)
85{ 85{
86 int ret; 86 int ret;
87 87
88 ret = wl12xx_acx_event_mbox_mask(wl, ~(wl->event_mask)); 88 ret = wl1251_acx_event_mbox_mask(wl, ~(wl->event_mask));
89 if (ret < 0) 89 if (ret < 0)
90 return ret; 90 return ret;
91 91
92 return 0; 92 return 0;
93} 93}
94 94
95void wl12xx_event_mbox_config(struct wl12xx *wl) 95void wl1251_event_mbox_config(struct wl1251 *wl)
96{ 96{
97 wl->mbox_ptr[0] = wl12xx_reg_read32(wl, REG_EVENT_MAILBOX_PTR); 97 wl->mbox_ptr[0] = wl1251_reg_read32(wl, REG_EVENT_MAILBOX_PTR);
98 wl->mbox_ptr[1] = wl->mbox_ptr[0] + sizeof(struct event_mailbox); 98 wl->mbox_ptr[1] = wl->mbox_ptr[0] + sizeof(struct event_mailbox);
99 99
100 wl12xx_debug(DEBUG_EVENT, "MBOX ptrs: 0x%x 0x%x", 100 wl1251_debug(DEBUG_EVENT, "MBOX ptrs: 0x%x 0x%x",
101 wl->mbox_ptr[0], wl->mbox_ptr[1]); 101 wl->mbox_ptr[0], wl->mbox_ptr[1]);
102} 102}
103 103
104int wl12xx_event_handle(struct wl12xx *wl, u8 mbox_num) 104int wl1251_event_handle(struct wl1251 *wl, u8 mbox_num)
105{ 105{
106 struct event_mailbox mbox; 106 struct event_mailbox mbox;
107 int ret; 107 int ret;
108 108
109 wl12xx_debug(DEBUG_EVENT, "EVENT on mbox %d", mbox_num); 109 wl1251_debug(DEBUG_EVENT, "EVENT on mbox %d", mbox_num);
110 110
111 if (mbox_num > 1) 111 if (mbox_num > 1)
112 return -EINVAL; 112 return -EINVAL;
113 113
114 /* first we read the mbox descriptor */ 114 /* first we read the mbox descriptor */
115 wl12xx_spi_mem_read(wl, wl->mbox_ptr[mbox_num], &mbox, 115 wl1251_spi_mem_read(wl, wl->mbox_ptr[mbox_num], &mbox,
116 sizeof(struct event_mailbox)); 116 sizeof(struct event_mailbox));
117 117
118 /* process the descriptor */ 118 /* process the descriptor */
119 ret = wl12xx_event_process(wl, &mbox); 119 ret = wl1251_event_process(wl, &mbox);
120 if (ret < 0) 120 if (ret < 0)
121 return ret; 121 return ret;
122 122
123 /* then we let the firmware know it can go on...*/ 123 /* then we let the firmware know it can go on...*/
124 wl12xx_reg_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_EVENT_ACK); 124 wl1251_reg_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_EVENT_ACK);
125 125
126 return 0; 126 return 0;
127} 127}
diff --git a/drivers/net/wireless/wl12xx/wl1251_event.h b/drivers/net/wireless/wl12xx/wl1251_event.h
index 1f4c2f7438a..be0ac54d624 100644
--- a/drivers/net/wireless/wl12xx/wl1251_event.h
+++ b/drivers/net/wireless/wl12xx/wl1251_event.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (c) 1998-2007 Texas Instruments Incorporated 4 * Copyright (c) 1998-2007 Texas Instruments Incorporated
5 * Copyright (C) 2008 Nokia Corporation 5 * Copyright (C) 2008 Nokia Corporation
@@ -22,8 +22,8 @@
22 * 22 *
23 */ 23 */
24 24
25#ifndef __WL12XX_EVENT_H__ 25#ifndef __WL1251_EVENT_H__
26#define __WL12XX_EVENT_H__ 26#define __WL1251_EVENT_H__
27 27
28/* 28/*
29 * Mbox events 29 * Mbox events
@@ -114,8 +114,8 @@ struct event_mailbox {
114 u8 padding[19]; 114 u8 padding[19];
115} __attribute__ ((packed)); 115} __attribute__ ((packed));
116 116
117int wl12xx_event_unmask(struct wl12xx *wl); 117int wl1251_event_unmask(struct wl1251 *wl);
118void wl12xx_event_mbox_config(struct wl12xx *wl); 118void wl1251_event_mbox_config(struct wl1251 *wl);
119int wl12xx_event_handle(struct wl12xx *wl, u8 mbox); 119int wl1251_event_handle(struct wl1251 *wl, u8 mbox);
120 120
121#endif 121#endif
diff --git a/drivers/net/wireless/wl12xx/wl1251_init.c b/drivers/net/wireless/wl12xx/wl1251_init.c
index 0929461a6d3..df6c60f0fd6 100644
--- a/drivers/net/wireless/wl12xx/wl1251_init.c
+++ b/drivers/net/wireless/wl12xx/wl1251_init.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (C) 2009 Nokia Corporation 4 * Copyright (C) 2009 Nokia Corporation
5 * 5 *
@@ -29,59 +29,59 @@
29#include "wl1251_acx.h" 29#include "wl1251_acx.h"
30#include "wl1251_cmd.h" 30#include "wl1251_cmd.h"
31 31
32int wl12xx_hw_init_hwenc_config(struct wl12xx *wl) 32int wl1251_hw_init_hwenc_config(struct wl1251 *wl)
33{ 33{
34 int ret; 34 int ret;
35 35
36 ret = wl12xx_acx_feature_cfg(wl); 36 ret = wl1251_acx_feature_cfg(wl);
37 if (ret < 0) { 37 if (ret < 0) {
38 wl12xx_warning("couldn't set feature config"); 38 wl1251_warning("couldn't set feature config");
39 return ret; 39 return ret;
40 } 40 }
41 41
42 ret = wl12xx_acx_default_key(wl, wl->default_key); 42 ret = wl1251_acx_default_key(wl, wl->default_key);
43 if (ret < 0) { 43 if (ret < 0) {
44 wl12xx_warning("couldn't set default key"); 44 wl1251_warning("couldn't set default key");
45 return ret; 45 return ret;
46 } 46 }
47 47
48 return 0; 48 return 0;
49} 49}
50 50
51int wl12xx_hw_init_templates_config(struct wl12xx *wl) 51int wl1251_hw_init_templates_config(struct wl1251 *wl)
52{ 52{
53 int ret; 53 int ret;
54 u8 partial_vbm[PARTIAL_VBM_MAX]; 54 u8 partial_vbm[PARTIAL_VBM_MAX];
55 55
56 /* send empty templates for fw memory reservation */ 56 /* send empty templates for fw memory reservation */
57 ret = wl12xx_cmd_template_set(wl, CMD_PROBE_REQ, NULL, 57 ret = wl1251_cmd_template_set(wl, CMD_PROBE_REQ, NULL,
58 sizeof(struct wl12xx_probe_req_template)); 58 sizeof(struct wl12xx_probe_req_template));
59 if (ret < 0) 59 if (ret < 0)
60 return ret; 60 return ret;
61 61
62 ret = wl12xx_cmd_template_set(wl, CMD_NULL_DATA, NULL, 62 ret = wl1251_cmd_template_set(wl, CMD_NULL_DATA, NULL,
63 sizeof(struct wl12xx_null_data_template)); 63 sizeof(struct wl12xx_null_data_template));
64 if (ret < 0) 64 if (ret < 0)
65 return ret; 65 return ret;
66 66
67 ret = wl12xx_cmd_template_set(wl, CMD_PS_POLL, NULL, 67 ret = wl1251_cmd_template_set(wl, CMD_PS_POLL, NULL,
68 sizeof(struct wl12xx_ps_poll_template)); 68 sizeof(struct wl12xx_ps_poll_template));
69 if (ret < 0) 69 if (ret < 0)
70 return ret; 70 return ret;
71 71
72 ret = wl12xx_cmd_template_set(wl, CMD_QOS_NULL_DATA, NULL, 72 ret = wl1251_cmd_template_set(wl, CMD_QOS_NULL_DATA, NULL,
73 sizeof 73 sizeof
74 (struct wl12xx_qos_null_data_template)); 74 (struct wl12xx_qos_null_data_template));
75 if (ret < 0) 75 if (ret < 0)
76 return ret; 76 return ret;
77 77
78 ret = wl12xx_cmd_template_set(wl, CMD_PROBE_RESP, NULL, 78 ret = wl1251_cmd_template_set(wl, CMD_PROBE_RESP, NULL,
79 sizeof 79 sizeof
80 (struct wl12xx_probe_resp_template)); 80 (struct wl12xx_probe_resp_template));
81 if (ret < 0) 81 if (ret < 0)
82 return ret; 82 return ret;
83 83
84 ret = wl12xx_cmd_template_set(wl, CMD_BEACON, NULL, 84 ret = wl1251_cmd_template_set(wl, CMD_BEACON, NULL,
85 sizeof 85 sizeof
86 (struct wl12xx_beacon_template)); 86 (struct wl12xx_beacon_template));
87 if (ret < 0) 87 if (ret < 0)
@@ -89,112 +89,112 @@ int wl12xx_hw_init_templates_config(struct wl12xx *wl)
89 89
90 /* tim templates, first reserve space then allocate an empty one */ 90 /* tim templates, first reserve space then allocate an empty one */
91 memset(partial_vbm, 0, PARTIAL_VBM_MAX); 91 memset(partial_vbm, 0, PARTIAL_VBM_MAX);
92 ret = wl12xx_cmd_vbm(wl, TIM_ELE_ID, partial_vbm, PARTIAL_VBM_MAX, 0); 92 ret = wl1251_cmd_vbm(wl, TIM_ELE_ID, partial_vbm, PARTIAL_VBM_MAX, 0);
93 if (ret < 0) 93 if (ret < 0)
94 return ret; 94 return ret;
95 95
96 ret = wl12xx_cmd_vbm(wl, TIM_ELE_ID, partial_vbm, 1, 0); 96 ret = wl1251_cmd_vbm(wl, TIM_ELE_ID, partial_vbm, 1, 0);
97 if (ret < 0) 97 if (ret < 0)
98 return ret; 98 return ret;
99 99
100 return 0; 100 return 0;
101} 101}
102 102
103int wl12xx_hw_init_rx_config(struct wl12xx *wl, u32 config, u32 filter) 103int wl1251_hw_init_rx_config(struct wl1251 *wl, u32 config, u32 filter)
104{ 104{
105 int ret; 105 int ret;
106 106
107 ret = wl12xx_acx_rx_msdu_life_time(wl, RX_MSDU_LIFETIME_DEF); 107 ret = wl1251_acx_rx_msdu_life_time(wl, RX_MSDU_LIFETIME_DEF);
108 if (ret < 0) 108 if (ret < 0)
109 return ret; 109 return ret;
110 110
111 ret = wl12xx_acx_rx_config(wl, config, filter); 111 ret = wl1251_acx_rx_config(wl, config, filter);
112 if (ret < 0) 112 if (ret < 0)
113 return ret; 113 return ret;
114 114
115 return 0; 115 return 0;
116} 116}
117 117
118int wl12xx_hw_init_phy_config(struct wl12xx *wl) 118int wl1251_hw_init_phy_config(struct wl1251 *wl)
119{ 119{
120 int ret; 120 int ret;
121 121
122 ret = wl12xx_acx_pd_threshold(wl); 122 ret = wl1251_acx_pd_threshold(wl);
123 if (ret < 0) 123 if (ret < 0)
124 return ret; 124 return ret;
125 125
126 ret = wl12xx_acx_slot(wl, DEFAULT_SLOT_TIME); 126 ret = wl1251_acx_slot(wl, DEFAULT_SLOT_TIME);
127 if (ret < 0) 127 if (ret < 0)
128 return ret; 128 return ret;
129 129
130 ret = wl12xx_acx_group_address_tbl(wl); 130 ret = wl1251_acx_group_address_tbl(wl);
131 if (ret < 0) 131 if (ret < 0)
132 return ret; 132 return ret;
133 133
134 ret = wl12xx_acx_service_period_timeout(wl); 134 ret = wl1251_acx_service_period_timeout(wl);
135 if (ret < 0) 135 if (ret < 0)
136 return ret; 136 return ret;
137 137
138 ret = wl12xx_acx_rts_threshold(wl, RTS_THRESHOLD_DEF); 138 ret = wl1251_acx_rts_threshold(wl, RTS_THRESHOLD_DEF);
139 if (ret < 0) 139 if (ret < 0)
140 return ret; 140 return ret;
141 141
142 return 0; 142 return 0;
143} 143}
144 144
145int wl12xx_hw_init_beacon_filter(struct wl12xx *wl) 145int wl1251_hw_init_beacon_filter(struct wl1251 *wl)
146{ 146{
147 int ret; 147 int ret;
148 148
149 ret = wl12xx_acx_beacon_filter_opt(wl); 149 ret = wl1251_acx_beacon_filter_opt(wl);
150 if (ret < 0) 150 if (ret < 0)
151 return ret; 151 return ret;
152 152
153 ret = wl12xx_acx_beacon_filter_table(wl); 153 ret = wl1251_acx_beacon_filter_table(wl);
154 if (ret < 0) 154 if (ret < 0)
155 return ret; 155 return ret;
156 156
157 return 0; 157 return 0;
158} 158}
159 159
160int wl12xx_hw_init_pta(struct wl12xx *wl) 160int wl1251_hw_init_pta(struct wl1251 *wl)
161{ 161{
162 int ret; 162 int ret;
163 163
164 ret = wl12xx_acx_sg_enable(wl); 164 ret = wl1251_acx_sg_enable(wl);
165 if (ret < 0) 165 if (ret < 0)
166 return ret; 166 return ret;
167 167
168 ret = wl12xx_acx_sg_cfg(wl); 168 ret = wl1251_acx_sg_cfg(wl);
169 if (ret < 0) 169 if (ret < 0)
170 return ret; 170 return ret;
171 171
172 return 0; 172 return 0;
173} 173}
174 174
175int wl12xx_hw_init_energy_detection(struct wl12xx *wl) 175int wl1251_hw_init_energy_detection(struct wl1251 *wl)
176{ 176{
177 int ret; 177 int ret;
178 178
179 ret = wl12xx_acx_cca_threshold(wl); 179 ret = wl1251_acx_cca_threshold(wl);
180 if (ret < 0) 180 if (ret < 0)
181 return ret; 181 return ret;
182 182
183 return 0; 183 return 0;
184} 184}
185 185
186int wl12xx_hw_init_beacon_broadcast(struct wl12xx *wl) 186int wl1251_hw_init_beacon_broadcast(struct wl1251 *wl)
187{ 187{
188 int ret; 188 int ret;
189 189
190 ret = wl12xx_acx_bcn_dtim_options(wl); 190 ret = wl1251_acx_bcn_dtim_options(wl);
191 if (ret < 0) 191 if (ret < 0)
192 return ret; 192 return ret;
193 193
194 return 0; 194 return 0;
195} 195}
196 196
197int wl12xx_hw_init_power_auth(struct wl12xx *wl) 197int wl1251_hw_init_power_auth(struct wl1251 *wl)
198{ 198{
199 return wl12xx_acx_sleep_auth(wl, WL12XX_PSM_CAM); 199 return wl1251_acx_sleep_auth(wl, WL1251_PSM_CAM);
200} 200}
diff --git a/drivers/net/wireless/wl12xx/wl1251_init.h b/drivers/net/wireless/wl12xx/wl1251_init.h
index 2b6268e1855..8596188e834 100644
--- a/drivers/net/wireless/wl12xx/wl1251_init.h
+++ b/drivers/net/wireless/wl12xx/wl1251_init.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (C) 2009 Nokia Corporation 4 * Copyright (C) 2009 Nokia Corporation
5 * 5 *
@@ -21,19 +21,19 @@
21 * 21 *
22 */ 22 */
23 23
24#ifndef __WL12XX_INIT_H__ 24#ifndef __WL1251_INIT_H__
25#define __WL12XX_INIT_H__ 25#define __WL1251_INIT_H__
26 26
27#include "wl1251.h" 27#include "wl1251.h"
28 28
29int wl12xx_hw_init_hwenc_config(struct wl12xx *wl); 29int wl1251_hw_init_hwenc_config(struct wl1251 *wl);
30int wl12xx_hw_init_templates_config(struct wl12xx *wl); 30int wl1251_hw_init_templates_config(struct wl1251 *wl);
31int wl12xx_hw_init_rx_config(struct wl12xx *wl, u32 config, u32 filter); 31int wl1251_hw_init_rx_config(struct wl1251 *wl, u32 config, u32 filter);
32int wl12xx_hw_init_phy_config(struct wl12xx *wl); 32int wl1251_hw_init_phy_config(struct wl1251 *wl);
33int wl12xx_hw_init_beacon_filter(struct wl12xx *wl); 33int wl1251_hw_init_beacon_filter(struct wl1251 *wl);
34int wl12xx_hw_init_pta(struct wl12xx *wl); 34int wl1251_hw_init_pta(struct wl1251 *wl);
35int wl12xx_hw_init_energy_detection(struct wl12xx *wl); 35int wl1251_hw_init_energy_detection(struct wl1251 *wl);
36int wl12xx_hw_init_beacon_broadcast(struct wl12xx *wl); 36int wl1251_hw_init_beacon_broadcast(struct wl1251 *wl);
37int wl12xx_hw_init_power_auth(struct wl12xx *wl); 37int wl1251_hw_init_power_auth(struct wl1251 *wl);
38 38
39#endif 39#endif
diff --git a/drivers/net/wireless/wl12xx/wl1251_main.c b/drivers/net/wireless/wl12xx/wl1251_main.c
index 41b9c616ee8..f4bc5796c24 100644
--- a/drivers/net/wireless/wl12xx/wl1251_main.c
+++ b/drivers/net/wireless/wl12xx/wl1251_main.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (C) 2008-2009 Nokia Corporation 4 * Copyright (C) 2008-2009 Nokia Corporation
5 * 5 *
@@ -43,26 +43,26 @@
43#include "wl1251_init.h" 43#include "wl1251_init.h"
44#include "wl1251_debugfs.h" 44#include "wl1251_debugfs.h"
45 45
46static void wl12xx_disable_interrupts(struct wl12xx *wl) 46static void wl1251_disable_interrupts(struct wl1251 *wl)
47{ 47{
48 disable_irq(wl->irq); 48 disable_irq(wl->irq);
49} 49}
50 50
51static void wl12xx_power_off(struct wl12xx *wl) 51static void wl1251_power_off(struct wl1251 *wl)
52{ 52{
53 wl->set_power(false); 53 wl->set_power(false);
54} 54}
55 55
56static void wl12xx_power_on(struct wl12xx *wl) 56static void wl1251_power_on(struct wl1251 *wl)
57{ 57{
58 wl->set_power(true); 58 wl->set_power(true);
59} 59}
60 60
61static irqreturn_t wl12xx_irq(int irq, void *cookie) 61static irqreturn_t wl1251_irq(int irq, void *cookie)
62{ 62{
63 struct wl12xx *wl; 63 struct wl1251 *wl;
64 64
65 wl12xx_debug(DEBUG_IRQ, "IRQ"); 65 wl1251_debug(DEBUG_IRQ, "IRQ");
66 66
67 wl = cookie; 67 wl = cookie;
68 68
@@ -71,7 +71,7 @@ static irqreturn_t wl12xx_irq(int irq, void *cookie)
71 return IRQ_HANDLED; 71 return IRQ_HANDLED;
72} 72}
73 73
74static int wl12xx_fetch_firmware(struct wl12xx *wl) 74static int wl1251_fetch_firmware(struct wl1251 *wl)
75{ 75{
76 const struct firmware *fw; 76 const struct firmware *fw;
77 int ret; 77 int ret;
@@ -79,12 +79,12 @@ static int wl12xx_fetch_firmware(struct wl12xx *wl)
79 ret = request_firmware(&fw, wl->chip.fw_filename, &wl->spi->dev); 79 ret = request_firmware(&fw, wl->chip.fw_filename, &wl->spi->dev);
80 80
81 if (ret < 0) { 81 if (ret < 0) {
82 wl12xx_error("could not get firmware: %d", ret); 82 wl1251_error("could not get firmware: %d", ret);
83 return ret; 83 return ret;
84 } 84 }
85 85
86 if (fw->size % 4) { 86 if (fw->size % 4) {
87 wl12xx_error("firmware size is not multiple of 32 bits: %zu", 87 wl1251_error("firmware size is not multiple of 32 bits: %zu",
88 fw->size); 88 fw->size);
89 ret = -EILSEQ; 89 ret = -EILSEQ;
90 goto out; 90 goto out;
@@ -94,7 +94,7 @@ static int wl12xx_fetch_firmware(struct wl12xx *wl)
94 wl->fw = kmalloc(wl->fw_len, GFP_KERNEL); 94 wl->fw = kmalloc(wl->fw_len, GFP_KERNEL);
95 95
96 if (!wl->fw) { 96 if (!wl->fw) {
97 wl12xx_error("could not allocate memory for the firmware"); 97 wl1251_error("could not allocate memory for the firmware");
98 ret = -ENOMEM; 98 ret = -ENOMEM;
99 goto out; 99 goto out;
100 } 100 }
@@ -109,7 +109,7 @@ out:
109 return ret; 109 return ret;
110} 110}
111 111
112static int wl12xx_fetch_nvs(struct wl12xx *wl) 112static int wl1251_fetch_nvs(struct wl1251 *wl)
113{ 113{
114 const struct firmware *fw; 114 const struct firmware *fw;
115 int ret; 115 int ret;
@@ -117,12 +117,12 @@ static int wl12xx_fetch_nvs(struct wl12xx *wl)
117 ret = request_firmware(&fw, wl->chip.nvs_filename, &wl->spi->dev); 117 ret = request_firmware(&fw, wl->chip.nvs_filename, &wl->spi->dev);
118 118
119 if (ret < 0) { 119 if (ret < 0) {
120 wl12xx_error("could not get nvs file: %d", ret); 120 wl1251_error("could not get nvs file: %d", ret);
121 return ret; 121 return ret;
122 } 122 }
123 123
124 if (fw->size % 4) { 124 if (fw->size % 4) {
125 wl12xx_error("nvs size is not multiple of 32 bits: %zu", 125 wl1251_error("nvs size is not multiple of 32 bits: %zu",
126 fw->size); 126 fw->size);
127 ret = -EILSEQ; 127 ret = -EILSEQ;
128 goto out; 128 goto out;
@@ -132,7 +132,7 @@ static int wl12xx_fetch_nvs(struct wl12xx *wl)
132 wl->nvs = kmalloc(wl->nvs_len, GFP_KERNEL); 132 wl->nvs = kmalloc(wl->nvs_len, GFP_KERNEL);
133 133
134 if (!wl->nvs) { 134 if (!wl->nvs) {
135 wl12xx_error("could not allocate memory for the nvs file"); 135 wl1251_error("could not allocate memory for the nvs file");
136 ret = -ENOMEM; 136 ret = -ENOMEM;
137 goto out; 137 goto out;
138 } 138 }
@@ -147,49 +147,49 @@ out:
147 return ret; 147 return ret;
148} 148}
149 149
150static void wl12xx_fw_wakeup(struct wl12xx *wl) 150static void wl1251_fw_wakeup(struct wl1251 *wl)
151{ 151{
152 u32 elp_reg; 152 u32 elp_reg;
153 153
154 elp_reg = ELPCTRL_WAKE_UP; 154 elp_reg = ELPCTRL_WAKE_UP;
155 wl12xx_write32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, elp_reg); 155 wl1251_write32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, elp_reg);
156 elp_reg = wl12xx_read32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR); 156 elp_reg = wl1251_read32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR);
157 157
158 if (!(elp_reg & ELPCTRL_WLAN_READY)) { 158 if (!(elp_reg & ELPCTRL_WLAN_READY)) {
159 wl12xx_warning("WLAN not ready"); 159 wl1251_warning("WLAN not ready");
160 } 160 }
161} 161}
162 162
163static int wl12xx_chip_wakeup(struct wl12xx *wl) 163static int wl1251_chip_wakeup(struct wl1251 *wl)
164{ 164{
165 int ret = 0; 165 int ret = 0;
166 166
167 wl12xx_power_on(wl); 167 wl1251_power_on(wl);
168 msleep(wl->chip.power_on_sleep); 168 msleep(wl->chip.power_on_sleep);
169 wl12xx_spi_reset(wl); 169 wl1251_spi_reset(wl);
170 wl12xx_spi_init(wl); 170 wl1251_spi_init(wl);
171 171
172 /* We don't need a real memory partition here, because we only want 172 /* We don't need a real memory partition here, because we only want
173 * to use the registers at this point. */ 173 * to use the registers at this point. */
174 wl12xx_set_partition(wl, 174 wl1251_set_partition(wl,
175 0x00000000, 175 0x00000000,
176 0x00000000, 176 0x00000000,
177 REGISTERS_BASE, 177 REGISTERS_BASE,
178 REGISTERS_DOWN_SIZE); 178 REGISTERS_DOWN_SIZE);
179 179
180 /* ELP module wake up */ 180 /* ELP module wake up */
181 wl12xx_fw_wakeup(wl); 181 wl1251_fw_wakeup(wl);
182 182
183 /* whal_FwCtrl_BootSm() */ 183 /* whal_FwCtrl_BootSm() */
184 184
185 /* 0. read chip id from CHIP_ID */ 185 /* 0. read chip id from CHIP_ID */
186 wl->chip.id = wl12xx_reg_read32(wl, CHIP_ID_B); 186 wl->chip.id = wl1251_reg_read32(wl, CHIP_ID_B);
187 187
188 /* 1. check if chip id is valid */ 188 /* 1. check if chip id is valid */
189 189
190 switch (wl->chip.id) { 190 switch (wl->chip.id) {
191 case CHIP_ID_1251_PG12: 191 case CHIP_ID_1251_PG12:
192 wl12xx_debug(DEBUG_BOOT, "chip id 0x%x (1251 PG12)", 192 wl1251_debug(DEBUG_BOOT, "chip id 0x%x (1251 PG12)",
193 wl->chip.id); 193 wl->chip.id);
194 194
195 wl1251_setup(wl); 195 wl1251_setup(wl);
@@ -198,20 +198,20 @@ static int wl12xx_chip_wakeup(struct wl12xx *wl)
198 case CHIP_ID_1251_PG10: 198 case CHIP_ID_1251_PG10:
199 case CHIP_ID_1251_PG11: 199 case CHIP_ID_1251_PG11:
200 default: 200 default:
201 wl12xx_error("unsupported chip id: 0x%x", wl->chip.id); 201 wl1251_error("unsupported chip id: 0x%x", wl->chip.id);
202 ret = -ENODEV; 202 ret = -ENODEV;
203 goto out; 203 goto out;
204 } 204 }
205 205
206 if (wl->fw == NULL) { 206 if (wl->fw == NULL) {
207 ret = wl12xx_fetch_firmware(wl); 207 ret = wl1251_fetch_firmware(wl);
208 if (ret < 0) 208 if (ret < 0)
209 goto out; 209 goto out;
210 } 210 }
211 211
212 /* No NVS from netlink, try to get it from the filesystem */ 212 /* No NVS from netlink, try to get it from the filesystem */
213 if (wl->nvs == NULL) { 213 if (wl->nvs == NULL) {
214 ret = wl12xx_fetch_nvs(wl); 214 ret = wl1251_fetch_nvs(wl);
215 if (ret < 0) 215 if (ret < 0)
216 goto out; 216 goto out;
217 } 217 }
@@ -220,18 +220,18 @@ out:
220 return ret; 220 return ret;
221} 221}
222 222
223static void wl12xx_filter_work(struct work_struct *work) 223static void wl1251_filter_work(struct work_struct *work)
224{ 224{
225 struct wl12xx *wl = 225 struct wl1251 *wl =
226 container_of(work, struct wl12xx, filter_work); 226 container_of(work, struct wl1251, filter_work);
227 int ret; 227 int ret;
228 228
229 mutex_lock(&wl->mutex); 229 mutex_lock(&wl->mutex);
230 230
231 if (wl->state == WL12XX_STATE_OFF) 231 if (wl->state == WL1251_STATE_OFF)
232 goto out; 232 goto out;
233 233
234 ret = wl12xx_ps_elp_wakeup(wl); 234 ret = wl1251_ps_elp_wakeup(wl);
235 if (ret < 0) 235 if (ret < 0)
236 goto out; 236 goto out;
237 237
@@ -241,27 +241,29 @@ static void wl12xx_filter_work(struct work_struct *work)
241 goto out_sleep; 241 goto out_sleep;
242 242
243out_sleep: 243out_sleep:
244 wl12xx_ps_elp_sleep(wl); 244 wl1251_ps_elp_sleep(wl);
245 245
246out: 246out:
247 mutex_unlock(&wl->mutex); 247 mutex_unlock(&wl->mutex);
248} 248}
249 249
250int wl12xx_plt_start(struct wl12xx *wl) 250int wl1251_plt_start(struct wl1251 *wl)
251{ 251{
252 int ret; 252 int ret;
253 253
254 wl12xx_notice("power up"); 254 mutex_lock(&wl->mutex);
255
256 wl1251_notice("power up");
255 257
256 if (wl->state != WL12XX_STATE_OFF) { 258 if (wl->state != WL1251_STATE_OFF) {
257 wl12xx_error("cannot go into PLT state because not " 259 wl1251_error("cannot go into PLT state because not "
258 "in off state: %d", wl->state); 260 "in off state: %d", wl->state);
259 return -EBUSY; 261 return -EBUSY;
260 } 262 }
261 263
262 wl->state = WL12XX_STATE_PLT; 264 wl->state = WL1251_STATE_PLT;
263 265
264 ret = wl12xx_chip_wakeup(wl); 266 ret = wl1251_chip_wakeup(wl);
265 if (ret < 0) 267 if (ret < 0)
266 return ret; 268 return ret;
267 269
@@ -269,7 +271,7 @@ int wl12xx_plt_start(struct wl12xx *wl)
269 if (ret < 0) 271 if (ret < 0)
270 return ret; 272 return ret;
271 273
272 wl12xx_notice("firmware booted in PLT mode (%s)", wl->chip.fw_ver); 274 wl1251_notice("firmware booted in PLT mode (%s)", wl->chip.fw_ver);
273 275
274 ret = wl->chip.op_plt_init(wl); 276 ret = wl->chip.op_plt_init(wl);
275 if (ret < 0) 277 if (ret < 0)
@@ -278,28 +280,30 @@ int wl12xx_plt_start(struct wl12xx *wl)
278 return 0; 280 return 0;
279} 281}
280 282
281int wl12xx_plt_stop(struct wl12xx *wl) 283int wl1251_plt_stop(struct wl1251 *wl)
282{ 284{
283 wl12xx_notice("power down"); 285 mutex_lock(&wl->mutex);
286
287 wl1251_notice("power down");
284 288
285 if (wl->state != WL12XX_STATE_PLT) { 289 if (wl->state != WL1251_STATE_PLT) {
286 wl12xx_error("cannot power down because not in PLT " 290 wl1251_error("cannot power down because not in PLT "
287 "state: %d", wl->state); 291 "state: %d", wl->state);
288 return -EBUSY; 292 return -EBUSY;
289 } 293 }
290 294
291 wl12xx_disable_interrupts(wl); 295 wl1251_disable_interrupts(wl);
292 wl12xx_power_off(wl); 296 wl1251_power_off(wl);
293 297
294 wl->state = WL12XX_STATE_OFF; 298 wl->state = WL1251_STATE_OFF;
295 299
296 return 0; 300 return 0;
297} 301}
298 302
299 303
300static int wl12xx_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 304static int wl1251_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
301{ 305{
302 struct wl12xx *wl = hw->priv; 306 struct wl1251 *wl = hw->priv;
303 307
304 skb_queue_tail(&wl->tx_queue, skb); 308 skb_queue_tail(&wl->tx_queue, skb);
305 309
@@ -314,7 +318,7 @@ static int wl12xx_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
314 * The workqueue is slow to process the tx_queue and we need stop 318 * The workqueue is slow to process the tx_queue and we need stop
315 * the queue here, otherwise the queue will get too long. 319 * the queue here, otherwise the queue will get too long.
316 */ 320 */
317 if (skb_queue_len(&wl->tx_queue) >= WL12XX_TX_QUEUE_MAX_LENGTH) { 321 if (skb_queue_len(&wl->tx_queue) >= WL1251_TX_QUEUE_MAX_LENGTH) {
318 ieee80211_stop_queues(wl->hw); 322 ieee80211_stop_queues(wl->hw);
319 323
320 /* 324 /*
@@ -328,23 +332,23 @@ static int wl12xx_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
328 return NETDEV_TX_OK; 332 return NETDEV_TX_OK;
329} 333}
330 334
331static int wl12xx_op_start(struct ieee80211_hw *hw) 335static int wl1251_op_start(struct ieee80211_hw *hw)
332{ 336{
333 struct wl12xx *wl = hw->priv; 337 struct wl1251 *wl = hw->priv;
334 int ret = 0; 338 int ret = 0;
335 339
336 wl12xx_debug(DEBUG_MAC80211, "mac80211 start"); 340 wl1251_debug(DEBUG_MAC80211, "mac80211 start");
337 341
338 mutex_lock(&wl->mutex); 342 mutex_lock(&wl->mutex);
339 343
340 if (wl->state != WL12XX_STATE_OFF) { 344 if (wl->state != WL1251_STATE_OFF) {
341 wl12xx_error("cannot start because not in off state: %d", 345 wl1251_error("cannot start because not in off state: %d",
342 wl->state); 346 wl->state);
343 ret = -EBUSY; 347 ret = -EBUSY;
344 goto out; 348 goto out;
345 } 349 }
346 350
347 ret = wl12xx_chip_wakeup(wl); 351 ret = wl1251_chip_wakeup(wl);
348 if (ret < 0) 352 if (ret < 0)
349 return ret; 353 return ret;
350 354
@@ -356,34 +360,34 @@ static int wl12xx_op_start(struct ieee80211_hw *hw)
356 if (ret < 0) 360 if (ret < 0)
357 goto out; 361 goto out;
358 362
359 ret = wl12xx_acx_station_id(wl); 363 ret = wl1251_acx_station_id(wl);
360 if (ret < 0) 364 if (ret < 0)
361 goto out; 365 goto out;
362 366
363 wl->state = WL12XX_STATE_ON; 367 wl->state = WL1251_STATE_ON;
364 368
365 wl12xx_info("firmware booted (%s)", wl->chip.fw_ver); 369 wl1251_info("firmware booted (%s)", wl->chip.fw_ver);
366 370
367out: 371out:
368 if (ret < 0) 372 if (ret < 0)
369 wl12xx_power_off(wl); 373 wl1251_power_off(wl);
370 374
371 mutex_unlock(&wl->mutex); 375 mutex_unlock(&wl->mutex);
372 376
373 return ret; 377 return ret;
374} 378}
375 379
376static void wl12xx_op_stop(struct ieee80211_hw *hw) 380static void wl1251_op_stop(struct ieee80211_hw *hw)
377{ 381{
378 struct wl12xx *wl = hw->priv; 382 struct wl1251 *wl = hw->priv;
379 383
380 wl12xx_info("down"); 384 wl1251_info("down");
381 385
382 wl12xx_debug(DEBUG_MAC80211, "mac80211 stop"); 386 wl1251_debug(DEBUG_MAC80211, "mac80211 stop");
383 387
384 mutex_lock(&wl->mutex); 388 mutex_lock(&wl->mutex);
385 389
386 WARN_ON(wl->state != WL12XX_STATE_ON); 390 WARN_ON(wl->state != WL1251_STATE_ON);
387 391
388 if (wl->scanning) { 392 if (wl->scanning) {
389 mutex_unlock(&wl->mutex); 393 mutex_unlock(&wl->mutex);
@@ -392,9 +396,9 @@ static void wl12xx_op_stop(struct ieee80211_hw *hw)
392 wl->scanning = false; 396 wl->scanning = false;
393 } 397 }
394 398
395 wl->state = WL12XX_STATE_OFF; 399 wl->state = WL1251_STATE_OFF;
396 400
397 wl12xx_disable_interrupts(wl); 401 wl1251_disable_interrupts(wl);
398 402
399 mutex_unlock(&wl->mutex); 403 mutex_unlock(&wl->mutex);
400 404
@@ -406,7 +410,7 @@ static void wl12xx_op_stop(struct ieee80211_hw *hw)
406 410
407 /* let's notify MAC80211 about the remaining pending TX frames */ 411 /* let's notify MAC80211 about the remaining pending TX frames */
408 wl->chip.op_tx_flush(wl); 412 wl->chip.op_tx_flush(wl);
409 wl12xx_power_off(wl); 413 wl1251_power_off(wl);
410 414
411 memset(wl->bssid, 0, ETH_ALEN); 415 memset(wl->bssid, 0, ETH_ALEN);
412 wl->listen_int = 1; 416 wl->listen_int = 1;
@@ -421,21 +425,21 @@ static void wl12xx_op_stop(struct ieee80211_hw *hw)
421 wl->elp = false; 425 wl->elp = false;
422 wl->psm = 0; 426 wl->psm = 0;
423 wl->tx_queue_stopped = false; 427 wl->tx_queue_stopped = false;
424 wl->power_level = WL12XX_DEFAULT_POWER_LEVEL; 428 wl->power_level = WL1251_DEFAULT_POWER_LEVEL;
425 429
426 wl12xx_debugfs_reset(wl); 430 wl1251_debugfs_reset(wl);
427 431
428 mutex_unlock(&wl->mutex); 432 mutex_unlock(&wl->mutex);
429} 433}
430 434
431static int wl12xx_op_add_interface(struct ieee80211_hw *hw, 435static int wl1251_op_add_interface(struct ieee80211_hw *hw,
432 struct ieee80211_if_init_conf *conf) 436 struct ieee80211_if_init_conf *conf)
433{ 437{
434 struct wl12xx *wl = hw->priv; 438 struct wl1251 *wl = hw->priv;
435 DECLARE_MAC_BUF(mac); 439 DECLARE_MAC_BUF(mac);
436 int ret = 0; 440 int ret = 0;
437 441
438 wl12xx_debug(DEBUG_MAC80211, "mac80211 add interface type %d mac %s", 442 wl1251_debug(DEBUG_MAC80211, "mac80211 add interface type %d mac %s",
439 conf->type, print_mac(mac, conf->mac_addr)); 443 conf->type, print_mac(mac, conf->mac_addr));
440 444
441 mutex_lock(&wl->mutex); 445 mutex_lock(&wl->mutex);
@@ -455,7 +459,7 @@ static int wl12xx_op_add_interface(struct ieee80211_hw *hw,
455 if (memcmp(wl->mac_addr, conf->mac_addr, ETH_ALEN)) { 459 if (memcmp(wl->mac_addr, conf->mac_addr, ETH_ALEN)) {
456 memcpy(wl->mac_addr, conf->mac_addr, ETH_ALEN); 460 memcpy(wl->mac_addr, conf->mac_addr, ETH_ALEN);
457 SET_IEEE80211_PERM_ADDR(wl->hw, wl->mac_addr); 461 SET_IEEE80211_PERM_ADDR(wl->hw, wl->mac_addr);
458 ret = wl12xx_acx_station_id(wl); 462 ret = wl1251_acx_station_id(wl);
459 if (ret < 0) 463 if (ret < 0)
460 goto out; 464 goto out;
461 } 465 }
@@ -465,13 +469,13 @@ out:
465 return ret; 469 return ret;
466} 470}
467 471
468static void wl12xx_op_remove_interface(struct ieee80211_hw *hw, 472static void wl1251_op_remove_interface(struct ieee80211_hw *hw,
469 struct ieee80211_if_init_conf *conf) 473 struct ieee80211_if_init_conf *conf)
470{ 474{
471 wl12xx_debug(DEBUG_MAC80211, "mac80211 remove interface"); 475 wl1251_debug(DEBUG_MAC80211, "mac80211 remove interface");
472} 476}
473 477
474static int wl12xx_build_null_data(struct wl12xx *wl) 478static int wl1251_build_null_data(struct wl1251 *wl)
475{ 479{
476 struct wl12xx_null_data_template template; 480 struct wl12xx_null_data_template template;
477 481
@@ -487,12 +491,12 @@ static int wl12xx_build_null_data(struct wl12xx *wl)
487 template.header.frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA | 491 template.header.frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
488 IEEE80211_STYPE_NULLFUNC); 492 IEEE80211_STYPE_NULLFUNC);
489 493
490 return wl12xx_cmd_template_set(wl, CMD_NULL_DATA, &template, 494 return wl1251_cmd_template_set(wl, CMD_NULL_DATA, &template,
491 sizeof(template)); 495 sizeof(template));
492 496
493} 497}
494 498
495static int wl12xx_build_ps_poll(struct wl12xx *wl, u16 aid) 499static int wl1251_build_ps_poll(struct wl1251 *wl, u16 aid)
496{ 500{
497 struct wl12xx_ps_poll_template template; 501 struct wl12xx_ps_poll_template template;
498 502
@@ -501,27 +505,27 @@ static int wl12xx_build_ps_poll(struct wl12xx *wl, u16 aid)
501 template.aid = aid; 505 template.aid = aid;
502 template.fc = cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL); 506 template.fc = cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL);
503 507
504 return wl12xx_cmd_template_set(wl, CMD_PS_POLL, &template, 508 return wl1251_cmd_template_set(wl, CMD_PS_POLL, &template,
505 sizeof(template)); 509 sizeof(template));
506 510
507} 511}
508 512
509static int wl12xx_op_config(struct ieee80211_hw *hw, u32 changed) 513static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed)
510{ 514{
511 struct wl12xx *wl = hw->priv; 515 struct wl1251 *wl = hw->priv;
512 struct ieee80211_conf *conf = &hw->conf; 516 struct ieee80211_conf *conf = &hw->conf;
513 int channel, ret = 0; 517 int channel, ret = 0;
514 518
515 channel = ieee80211_frequency_to_channel(conf->channel->center_freq); 519 channel = ieee80211_frequency_to_channel(conf->channel->center_freq);
516 520
517 wl12xx_debug(DEBUG_MAC80211, "mac80211 config ch %d psm %s power %d", 521 wl1251_debug(DEBUG_MAC80211, "mac80211 config ch %d psm %s power %d",
518 channel, 522 channel,
519 conf->flags & IEEE80211_CONF_PS ? "on" : "off", 523 conf->flags & IEEE80211_CONF_PS ? "on" : "off",
520 conf->power_level); 524 conf->power_level);
521 525
522 mutex_lock(&wl->mutex); 526 mutex_lock(&wl->mutex);
523 527
524 ret = wl12xx_ps_elp_wakeup(wl); 528 ret = wl1251_ps_elp_wakeup(wl);
525 if (ret < 0) 529 if (ret < 0)
526 goto out; 530 goto out;
527 531
@@ -534,12 +538,12 @@ static int wl12xx_op_config(struct ieee80211_hw *hw, u32 changed)
534 wl->channel = channel; 538 wl->channel = channel;
535 } 539 }
536 540
537 ret = wl12xx_build_null_data(wl); 541 ret = wl1251_build_null_data(wl);
538 if (ret < 0) 542 if (ret < 0)
539 goto out_sleep; 543 goto out_sleep;
540 544
541 if (conf->flags & IEEE80211_CONF_PS && !wl->psm_requested) { 545 if (conf->flags & IEEE80211_CONF_PS && !wl->psm_requested) {
542 wl12xx_info("psm enabled"); 546 wl1251_info("psm enabled");
543 547
544 wl->psm_requested = true; 548 wl->psm_requested = true;
545 549
@@ -548,19 +552,19 @@ static int wl12xx_op_config(struct ieee80211_hw *hw, u32 changed)
548 * If we're not, we'll enter it when joining an SSID, 552 * If we're not, we'll enter it when joining an SSID,
549 * through the bss_info_changed() hook. 553 * through the bss_info_changed() hook.
550 */ 554 */
551 ret = wl12xx_ps_set_mode(wl, STATION_POWER_SAVE_MODE); 555 ret = wl1251_ps_set_mode(wl, STATION_POWER_SAVE_MODE);
552 } else if (!(conf->flags & IEEE80211_CONF_PS) && 556 } else if (!(conf->flags & IEEE80211_CONF_PS) &&
553 wl->psm_requested) { 557 wl->psm_requested) {
554 wl12xx_info("psm disabled"); 558 wl1251_info("psm disabled");
555 559
556 wl->psm_requested = false; 560 wl->psm_requested = false;
557 561
558 if (wl->psm) 562 if (wl->psm)
559 ret = wl12xx_ps_set_mode(wl, STATION_ACTIVE_MODE); 563 ret = wl1251_ps_set_mode(wl, STATION_ACTIVE_MODE);
560 } 564 }
561 565
562 if (conf->power_level != wl->power_level) { 566 if (conf->power_level != wl->power_level) {
563 ret = wl12xx_acx_tx_power(wl, conf->power_level); 567 ret = wl1251_acx_tx_power(wl, conf->power_level);
564 if (ret < 0) 568 if (ret < 0)
565 goto out; 569 goto out;
566 570
@@ -568,7 +572,7 @@ static int wl12xx_op_config(struct ieee80211_hw *hw, u32 changed)
568 } 572 }
569 573
570out_sleep: 574out_sleep:
571 wl12xx_ps_elp_sleep(wl); 575 wl1251_ps_elp_sleep(wl);
572 576
573out: 577out:
574 mutex_unlock(&wl->mutex); 578 mutex_unlock(&wl->mutex);
@@ -576,25 +580,25 @@ out:
576 return ret; 580 return ret;
577} 581}
578 582
579#define WL12XX_SUPPORTED_FILTERS (FIF_PROMISC_IN_BSS | \ 583#define WL1251_SUPPORTED_FILTERS (FIF_PROMISC_IN_BSS | \
580 FIF_ALLMULTI | \ 584 FIF_ALLMULTI | \
581 FIF_FCSFAIL | \ 585 FIF_FCSFAIL | \
582 FIF_BCN_PRBRESP_PROMISC | \ 586 FIF_BCN_PRBRESP_PROMISC | \
583 FIF_CONTROL | \ 587 FIF_CONTROL | \
584 FIF_OTHER_BSS) 588 FIF_OTHER_BSS)
585 589
586static void wl12xx_op_configure_filter(struct ieee80211_hw *hw, 590static void wl1251_op_configure_filter(struct ieee80211_hw *hw,
587 unsigned int changed, 591 unsigned int changed,
588 unsigned int *total, 592 unsigned int *total,
589 int mc_count, 593 int mc_count,
590 struct dev_addr_list *mc_list) 594 struct dev_addr_list *mc_list)
591{ 595{
592 struct wl12xx *wl = hw->priv; 596 struct wl1251 *wl = hw->priv;
593 597
594 wl12xx_debug(DEBUG_MAC80211, "mac80211 configure filter"); 598 wl1251_debug(DEBUG_MAC80211, "mac80211 configure filter");
595 599
596 *total &= WL12XX_SUPPORTED_FILTERS; 600 *total &= WL1251_SUPPORTED_FILTERS;
597 changed &= WL12XX_SUPPORTED_FILTERS; 601 changed &= WL1251_SUPPORTED_FILTERS;
598 602
599 if (changed == 0) 603 if (changed == 0)
600 /* no filters which we support changed */ 604 /* no filters which we support changed */
@@ -602,8 +606,8 @@ static void wl12xx_op_configure_filter(struct ieee80211_hw *hw,
602 606
603 /* FIXME: wl->rx_config and wl->rx_filter are not protected */ 607 /* FIXME: wl->rx_config and wl->rx_filter are not protected */
604 608
605 wl->rx_config = WL12XX_DEFAULT_RX_CONFIG; 609 wl->rx_config = WL1251_DEFAULT_RX_CONFIG;
606 wl->rx_filter = WL12XX_DEFAULT_RX_FILTER; 610 wl->rx_filter = WL1251_DEFAULT_RX_FILTER;
607 611
608 if (*total & FIF_PROMISC_IN_BSS) { 612 if (*total & FIF_PROMISC_IN_BSS) {
609 wl->rx_config |= CFG_BSSID_FILTER_EN; 613 wl->rx_config |= CFG_BSSID_FILTER_EN;
@@ -635,8 +639,8 @@ static void wl12xx_op_configure_filter(struct ieee80211_hw *hw,
635} 639}
636 640
637/* HW encryption */ 641/* HW encryption */
638static int wl12xx_set_key_type(struct wl12xx *wl, 642static int wl1251_set_key_type(struct wl1251 *wl,
639 struct wl12xx_cmd_set_keys *key, 643 struct wl1251_cmd_set_keys *key,
640 enum set_key_cmd cmd, 644 enum set_key_cmd cmd,
641 struct ieee80211_key_conf *mac80211_key, 645 struct ieee80211_key_conf *mac80211_key,
642 const u8 *addr) 646 const u8 *addr)
@@ -666,27 +670,27 @@ static int wl12xx_set_key_type(struct wl12xx *wl,
666 mac80211_key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 670 mac80211_key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
667 break; 671 break;
668 default: 672 default:
669 wl12xx_error("Unknown key algo 0x%x", mac80211_key->alg); 673 wl1251_error("Unknown key algo 0x%x", mac80211_key->alg);
670 return -EOPNOTSUPP; 674 return -EOPNOTSUPP;
671 } 675 }
672 676
673 return 0; 677 return 0;
674} 678}
675 679
676static int wl12xx_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, 680static int wl1251_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
677 struct ieee80211_vif *vif, 681 struct ieee80211_vif *vif,
678 struct ieee80211_sta *sta, 682 struct ieee80211_sta *sta,
679 struct ieee80211_key_conf *key) 683 struct ieee80211_key_conf *key)
680{ 684{
681 struct wl12xx *wl = hw->priv; 685 struct wl1251 *wl = hw->priv;
682 struct wl12xx_cmd_set_keys *wl_cmd; 686 struct wl1251_cmd_set_keys *wl_cmd;
683 const u8 *addr; 687 const u8 *addr;
684 int ret; 688 int ret;
685 689
686 static const u8 bcast_addr[ETH_ALEN] = 690 static const u8 bcast_addr[ETH_ALEN] =
687 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 691 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
688 692
689 wl12xx_debug(DEBUG_MAC80211, "mac80211 set key"); 693 wl1251_debug(DEBUG_MAC80211, "mac80211 set key");
690 694
691 wl_cmd = kzalloc(sizeof(*wl_cmd), GFP_KERNEL); 695 wl_cmd = kzalloc(sizeof(*wl_cmd), GFP_KERNEL);
692 if (!wl_cmd) { 696 if (!wl_cmd) {
@@ -696,11 +700,11 @@ static int wl12xx_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
696 700
697 addr = sta ? sta->addr : bcast_addr; 701 addr = sta ? sta->addr : bcast_addr;
698 702
699 wl12xx_debug(DEBUG_CRYPT, "CMD: 0x%x", cmd); 703 wl1251_debug(DEBUG_CRYPT, "CMD: 0x%x", cmd);
700 wl12xx_dump(DEBUG_CRYPT, "ADDR: ", addr, ETH_ALEN); 704 wl1251_dump(DEBUG_CRYPT, "ADDR: ", addr, ETH_ALEN);
701 wl12xx_debug(DEBUG_CRYPT, "Key: algo:0x%x, id:%d, len:%d flags 0x%x", 705 wl1251_debug(DEBUG_CRYPT, "Key: algo:0x%x, id:%d, len:%d flags 0x%x",
702 key->alg, key->keyidx, key->keylen, key->flags); 706 key->alg, key->keyidx, key->keylen, key->flags);
703 wl12xx_dump(DEBUG_CRYPT, "KEY: ", key->key, key->keylen); 707 wl1251_dump(DEBUG_CRYPT, "KEY: ", key->key, key->keylen);
704 708
705 if (is_zero_ether_addr(addr)) { 709 if (is_zero_ether_addr(addr)) {
706 /* We dont support TX only encryption */ 710 /* We dont support TX only encryption */
@@ -710,7 +714,7 @@ static int wl12xx_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
710 714
711 mutex_lock(&wl->mutex); 715 mutex_lock(&wl->mutex);
712 716
713 ret = wl12xx_ps_elp_wakeup(wl); 717 ret = wl1251_ps_elp_wakeup(wl);
714 if (ret < 0) 718 if (ret < 0)
715 goto out_unlock; 719 goto out_unlock;
716 720
@@ -722,13 +726,13 @@ static int wl12xx_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
722 wl_cmd->key_action = KEY_REMOVE; 726 wl_cmd->key_action = KEY_REMOVE;
723 break; 727 break;
724 default: 728 default:
725 wl12xx_error("Unsupported key cmd 0x%x", cmd); 729 wl1251_error("Unsupported key cmd 0x%x", cmd);
726 break; 730 break;
727 } 731 }
728 732
729 ret = wl12xx_set_key_type(wl, wl_cmd, cmd, key, addr); 733 ret = wl1251_set_key_type(wl, wl_cmd, cmd, key, addr);
730 if (ret < 0) { 734 if (ret < 0) {
731 wl12xx_error("Set KEY type failed"); 735 wl1251_error("Set KEY type failed");
732 goto out_sleep; 736 goto out_sleep;
733 } 737 }
734 738
@@ -755,16 +759,16 @@ static int wl12xx_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
755 wl_cmd->id = key->keyidx; 759 wl_cmd->id = key->keyidx;
756 wl_cmd->ssid_profile = 0; 760 wl_cmd->ssid_profile = 0;
757 761
758 wl12xx_dump(DEBUG_CRYPT, "TARGET KEY: ", wl_cmd, sizeof(*wl_cmd)); 762 wl1251_dump(DEBUG_CRYPT, "TARGET KEY: ", wl_cmd, sizeof(*wl_cmd));
759 763
760 ret = wl12xx_cmd_send(wl, CMD_SET_KEYS, wl_cmd, sizeof(*wl_cmd)); 764 ret = wl1251_cmd_send(wl, CMD_SET_KEYS, wl_cmd, sizeof(*wl_cmd));
761 if (ret < 0) { 765 if (ret < 0) {
762 wl12xx_warning("could not set keys"); 766 wl1251_warning("could not set keys");
763 goto out_sleep; 767 goto out_sleep;
764 } 768 }
765 769
766out_sleep: 770out_sleep:
767 wl12xx_ps_elp_sleep(wl); 771 wl1251_ps_elp_sleep(wl);
768 772
769out_unlock: 773out_unlock:
770 mutex_unlock(&wl->mutex); 774 mutex_unlock(&wl->mutex);
@@ -775,7 +779,7 @@ out:
775 return ret; 779 return ret;
776} 780}
777 781
778static int wl12xx_build_basic_rates(char *rates) 782static int wl1251_build_basic_rates(char *rates)
779{ 783{
780 u8 index = 0; 784 u8 index = 0;
781 785
@@ -787,7 +791,7 @@ static int wl12xx_build_basic_rates(char *rates)
787 return index; 791 return index;
788} 792}
789 793
790static int wl12xx_build_extended_rates(char *rates) 794static int wl1251_build_extended_rates(char *rates)
791{ 795{
792 u8 index = 0; 796 u8 index = 0;
793 797
@@ -804,7 +808,7 @@ static int wl12xx_build_extended_rates(char *rates)
804} 808}
805 809
806 810
807static int wl12xx_build_probe_req(struct wl12xx *wl, u8 *ssid, size_t ssid_len) 811static int wl1251_build_probe_req(struct wl1251 *wl, u8 *ssid, size_t ssid_len)
808{ 812{
809 struct wl12xx_probe_req_template template; 813 struct wl12xx_probe_req_template template;
810 struct wl12xx_ie_rates *rates; 814 struct wl12xx_ie_rates *rates;
@@ -831,27 +835,27 @@ static int wl12xx_build_probe_req(struct wl12xx *wl, u8 *ssid, size_t ssid_len)
831 /* Basic Rates */ 835 /* Basic Rates */
832 rates = (struct wl12xx_ie_rates *)ptr; 836 rates = (struct wl12xx_ie_rates *)ptr;
833 rates->header.id = WLAN_EID_SUPP_RATES; 837 rates->header.id = WLAN_EID_SUPP_RATES;
834 rates->header.len = wl12xx_build_basic_rates(rates->rates); 838 rates->header.len = wl1251_build_basic_rates(rates->rates);
835 size += sizeof(struct wl12xx_ie_header) + rates->header.len; 839 size += sizeof(struct wl12xx_ie_header) + rates->header.len;
836 ptr += sizeof(struct wl12xx_ie_header) + rates->header.len; 840 ptr += sizeof(struct wl12xx_ie_header) + rates->header.len;
837 841
838 /* Extended rates */ 842 /* Extended rates */
839 rates = (struct wl12xx_ie_rates *)ptr; 843 rates = (struct wl12xx_ie_rates *)ptr;
840 rates->header.id = WLAN_EID_EXT_SUPP_RATES; 844 rates->header.id = WLAN_EID_EXT_SUPP_RATES;
841 rates->header.len = wl12xx_build_extended_rates(rates->rates); 845 rates->header.len = wl1251_build_extended_rates(rates->rates);
842 size += sizeof(struct wl12xx_ie_header) + rates->header.len; 846 size += sizeof(struct wl12xx_ie_header) + rates->header.len;
843 847
844 wl12xx_dump(DEBUG_SCAN, "PROBE REQ: ", &template, size); 848 wl1251_dump(DEBUG_SCAN, "PROBE REQ: ", &template, size);
845 849
846 return wl12xx_cmd_template_set(wl, CMD_PROBE_REQ, &template, 850 return wl1251_cmd_template_set(wl, CMD_PROBE_REQ, &template,
847 size); 851 size);
848} 852}
849 853
850static int wl12xx_hw_scan(struct wl12xx *wl, u8 *ssid, size_t len, 854static int wl1251_hw_scan(struct wl1251 *wl, u8 *ssid, size_t len,
851 u8 active_scan, u8 high_prio, u8 num_channels, 855 u8 active_scan, u8 high_prio, u8 num_channels,
852 u8 probe_requests) 856 u8 probe_requests)
853{ 857{
854 struct wl12xx_cmd_trigger_scan_to *trigger = NULL; 858 struct wl1251_cmd_trigger_scan_to *trigger = NULL;
855 struct cmd_scan *params = NULL; 859 struct cmd_scan *params = NULL;
856 int i, ret; 860 int i, ret;
857 u16 scan_options = 0; 861 u16 scan_options = 0;
@@ -902,9 +906,9 @@ static int wl12xx_hw_scan(struct wl12xx *wl, u8 *ssid, size_t len,
902 memset(params->params.ssid, 0, 32); 906 memset(params->params.ssid, 0, 32);
903 } 907 }
904 908
905 ret = wl12xx_build_probe_req(wl, ssid, len); 909 ret = wl1251_build_probe_req(wl, ssid, len);
906 if (ret < 0) { 910 if (ret < 0) {
907 wl12xx_error("PROBE request template failed"); 911 wl1251_error("PROBE request template failed");
908 goto out; 912 goto out;
909 } 913 }
910 914
@@ -914,25 +918,25 @@ static int wl12xx_hw_scan(struct wl12xx *wl, u8 *ssid, size_t len,
914 918
915 trigger->timeout = 0; 919 trigger->timeout = 0;
916 920
917 ret = wl12xx_cmd_send(wl, CMD_TRIGGER_SCAN_TO, trigger, 921 ret = wl1251_cmd_send(wl, CMD_TRIGGER_SCAN_TO, trigger,
918 sizeof(*trigger)); 922 sizeof(*trigger));
919 if (ret < 0) { 923 if (ret < 0) {
920 wl12xx_error("trigger scan to failed for hw scan"); 924 wl1251_error("trigger scan to failed for hw scan");
921 goto out; 925 goto out;
922 } 926 }
923 927
924 wl12xx_dump(DEBUG_SCAN, "SCAN: ", params, sizeof(*params)); 928 wl1251_dump(DEBUG_SCAN, "SCAN: ", params, sizeof(*params));
925 929
926 wl->scanning = true; 930 wl->scanning = true;
927 931
928 ret = wl12xx_cmd_send(wl, CMD_SCAN, params, sizeof(*params)); 932 ret = wl1251_cmd_send(wl, CMD_SCAN, params, sizeof(*params));
929 if (ret < 0) 933 if (ret < 0)
930 wl12xx_error("SCAN failed"); 934 wl1251_error("SCAN failed");
931 935
932 wl12xx_spi_mem_read(wl, wl->cmd_box_addr, params, sizeof(*params)); 936 wl1251_spi_mem_read(wl, wl->cmd_box_addr, params, sizeof(*params));
933 937
934 if (params->header.status != CMD_STATUS_SUCCESS) { 938 if (params->header.status != CMD_STATUS_SUCCESS) {
935 wl12xx_error("TEST command answer error: %d", 939 wl1251_error("TEST command answer error: %d",
936 params->header.status); 940 params->header.status);
937 wl->scanning = false; 941 wl->scanning = false;
938 ret = -EIO; 942 ret = -EIO;
@@ -945,15 +949,15 @@ out:
945 949
946} 950}
947 951
948static int wl12xx_op_hw_scan(struct ieee80211_hw *hw, 952static int wl1251_op_hw_scan(struct ieee80211_hw *hw,
949 struct cfg80211_scan_request *req) 953 struct cfg80211_scan_request *req)
950{ 954{
951 struct wl12xx *wl = hw->priv; 955 struct wl1251 *wl = hw->priv;
952 int ret; 956 int ret;
953 u8 *ssid = NULL; 957 u8 *ssid = NULL;
954 size_t ssid_len = 0; 958 size_t ssid_len = 0;
955 959
956 wl12xx_debug(DEBUG_MAC80211, "mac80211 hw scan"); 960 wl1251_debug(DEBUG_MAC80211, "mac80211 hw scan");
957 961
958 if (req->n_ssids) { 962 if (req->n_ssids) {
959 ssid = req->ssids[0].ssid; 963 ssid = req->ssids[0].ssid;
@@ -962,13 +966,13 @@ static int wl12xx_op_hw_scan(struct ieee80211_hw *hw,
962 966
963 mutex_lock(&wl->mutex); 967 mutex_lock(&wl->mutex);
964 968
965 ret = wl12xx_ps_elp_wakeup(wl); 969 ret = wl1251_ps_elp_wakeup(wl);
966 if (ret < 0) 970 if (ret < 0)
967 goto out; 971 goto out;
968 972
969 ret = wl12xx_hw_scan(hw->priv, ssid, ssid_len, 1, 0, 13, 3); 973 ret = wl1251_hw_scan(hw->priv, ssid, ssid_len, 1, 0, 13, 3);
970 974
971 wl12xx_ps_elp_sleep(wl); 975 wl1251_ps_elp_sleep(wl);
972 976
973out: 977out:
974 mutex_unlock(&wl->mutex); 978 mutex_unlock(&wl->mutex);
@@ -976,22 +980,22 @@ out:
976 return ret; 980 return ret;
977} 981}
978 982
979static int wl12xx_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value) 983static int wl1251_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
980{ 984{
981 struct wl12xx *wl = hw->priv; 985 struct wl1251 *wl = hw->priv;
982 int ret; 986 int ret;
983 987
984 mutex_lock(&wl->mutex); 988 mutex_lock(&wl->mutex);
985 989
986 ret = wl12xx_ps_elp_wakeup(wl); 990 ret = wl1251_ps_elp_wakeup(wl);
987 if (ret < 0) 991 if (ret < 0)
988 goto out; 992 goto out;
989 993
990 ret = wl12xx_acx_rts_threshold(wl, (u16) value); 994 ret = wl1251_acx_rts_threshold(wl, (u16) value);
991 if (ret < 0) 995 if (ret < 0)
992 wl12xx_warning("wl12xx_op_set_rts_threshold failed: %d", ret); 996 wl1251_warning("wl1251_op_set_rts_threshold failed: %d", ret);
993 997
994 wl12xx_ps_elp_sleep(wl); 998 wl1251_ps_elp_sleep(wl);
995 999
996out: 1000out:
997 mutex_unlock(&wl->mutex); 1001 mutex_unlock(&wl->mutex);
@@ -999,21 +1003,21 @@ out:
999 return ret; 1003 return ret;
1000} 1004}
1001 1005
1002static void wl12xx_op_bss_info_changed(struct ieee80211_hw *hw, 1006static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw,
1003 struct ieee80211_vif *vif, 1007 struct ieee80211_vif *vif,
1004 struct ieee80211_bss_conf *bss_conf, 1008 struct ieee80211_bss_conf *bss_conf,
1005 u32 changed) 1009 u32 changed)
1006{ 1010{
1007 enum wl12xx_cmd_ps_mode mode; 1011 enum wl1251_cmd_ps_mode mode;
1008 struct wl12xx *wl = hw->priv; 1012 struct wl1251 *wl = hw->priv;
1009 struct sk_buff *beacon; 1013 struct sk_buff *beacon;
1010 int ret; 1014 int ret;
1011 1015
1012 wl12xx_debug(DEBUG_MAC80211, "mac80211 bss info changed"); 1016 wl1251_debug(DEBUG_MAC80211, "mac80211 bss info changed");
1013 1017
1014 mutex_lock(&wl->mutex); 1018 mutex_lock(&wl->mutex);
1015 1019
1016 ret = wl12xx_ps_elp_wakeup(wl); 1020 ret = wl1251_ps_elp_wakeup(wl);
1017 if (ret < 0) 1021 if (ret < 0)
1018 goto out; 1022 goto out;
1019 1023
@@ -1021,18 +1025,18 @@ static void wl12xx_op_bss_info_changed(struct ieee80211_hw *hw,
1021 if (bss_conf->assoc) { 1025 if (bss_conf->assoc) {
1022 wl->aid = bss_conf->aid; 1026 wl->aid = bss_conf->aid;
1023 1027
1024 ret = wl12xx_build_ps_poll(wl, wl->aid); 1028 ret = wl1251_build_ps_poll(wl, wl->aid);
1025 if (ret < 0) 1029 if (ret < 0)
1026 goto out_sleep; 1030 goto out_sleep;
1027 1031
1028 ret = wl12xx_acx_aid(wl, wl->aid); 1032 ret = wl1251_acx_aid(wl, wl->aid);
1029 if (ret < 0) 1033 if (ret < 0)
1030 goto out_sleep; 1034 goto out_sleep;
1031 1035
1032 /* If we want to go in PSM but we're not there yet */ 1036 /* If we want to go in PSM but we're not there yet */
1033 if (wl->psm_requested && !wl->psm) { 1037 if (wl->psm_requested && !wl->psm) {
1034 mode = STATION_POWER_SAVE_MODE; 1038 mode = STATION_POWER_SAVE_MODE;
1035 ret = wl12xx_ps_set_mode(wl, mode); 1039 ret = wl1251_ps_set_mode(wl, mode);
1036 if (ret < 0) 1040 if (ret < 0)
1037 goto out_sleep; 1041 goto out_sleep;
1038 } 1042 }
@@ -1040,50 +1044,52 @@ static void wl12xx_op_bss_info_changed(struct ieee80211_hw *hw,
1040 } 1044 }
1041 if (changed & BSS_CHANGED_ERP_SLOT) { 1045 if (changed & BSS_CHANGED_ERP_SLOT) {
1042 if (bss_conf->use_short_slot) 1046 if (bss_conf->use_short_slot)
1043 ret = wl12xx_acx_slot(wl, SLOT_TIME_SHORT); 1047 ret = wl1251_acx_slot(wl, SLOT_TIME_SHORT);
1044 else 1048 else
1045 ret = wl12xx_acx_slot(wl, SLOT_TIME_LONG); 1049 ret = wl1251_acx_slot(wl, SLOT_TIME_LONG);
1046 if (ret < 0) { 1050 if (ret < 0) {
1047 wl12xx_warning("Set slot time failed %d", ret); 1051 wl1251_warning("Set slot time failed %d", ret);
1048 goto out_sleep; 1052 goto out_sleep;
1049 } 1053 }
1050 } 1054 }
1051 1055
1052 if (changed & BSS_CHANGED_ERP_PREAMBLE) { 1056 if (changed & BSS_CHANGED_ERP_PREAMBLE) {
1053 if (bss_conf->use_short_preamble) 1057 if (bss_conf->use_short_preamble)
1054 wl12xx_acx_set_preamble(wl, ACX_PREAMBLE_SHORT); 1058 wl1251_acx_set_preamble(wl, ACX_PREAMBLE_SHORT);
1055 else 1059 else
1056 wl12xx_acx_set_preamble(wl, ACX_PREAMBLE_LONG); 1060 wl1251_acx_set_preamble(wl, ACX_PREAMBLE_LONG);
1057 } 1061 }
1058 1062
1059 if (changed & BSS_CHANGED_ERP_CTS_PROT) { 1063 if (changed & BSS_CHANGED_ERP_CTS_PROT) {
1060 if (bss_conf->use_cts_prot) 1064 if (bss_conf->use_cts_prot)
1061 ret = wl12xx_acx_cts_protect(wl, CTSPROTECT_ENABLE); 1065 ret = wl1251_acx_cts_protect(wl, CTSPROTECT_ENABLE);
1062 else 1066 else
1063 ret = wl12xx_acx_cts_protect(wl, CTSPROTECT_DISABLE); 1067 ret = wl1251_acx_cts_protect(wl, CTSPROTECT_DISABLE);
1064 if (ret < 0) { 1068 if (ret < 0) {
1065 wl12xx_warning("Set ctsprotect failed %d", ret); 1069 wl1251_warning("Set ctsprotect failed %d", ret);
1066 goto out_sleep; 1070 goto out;
1067 } 1071 }
1068 } 1072 }
1069 1073
1070 if (changed & BSS_CHANGED_BSSID) { 1074 if (changed & BSS_CHANGED_BSSID) {
1071 memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN); 1075 memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN);
1072 1076
1073 ret = wl12xx_build_null_data(wl); 1077 ret = wl1251_build_null_data(wl);
1074 if (ret < 0) 1078 if (ret < 0)
1075 goto out; 1079 goto out;
1076 1080
1077 if (wl->bss_type != BSS_TYPE_IBSS) { 1081 if (wl->bss_type != BSS_TYPE_IBSS) {
1078 ret = wl->chip.op_cmd_join(wl, wl->bss_type, 5, 100, 1); 1082 ret = wl1251_cmd_join(wl, wl->bss_type, 5, 100, 1);
1079 if (ret < 0) 1083 if (ret < 0)
1080 goto out; 1084 goto out_sleep;
1085 wl1251_warning("Set ctsprotect failed %d", ret);
1086 goto out_sleep;
1081 } 1087 }
1082 } 1088 }
1083 1089
1084 if (changed & BSS_CHANGED_BEACON) { 1090 if (changed & BSS_CHANGED_BEACON) {
1085 beacon = ieee80211_beacon_get(hw, vif); 1091 beacon = ieee80211_beacon_get(hw, vif);
1086 ret = wl12xx_cmd_template_set(wl, CMD_BEACON, beacon->data, 1092 ret = wl1251_cmd_template_set(wl, CMD_BEACON, beacon->data,
1087 beacon->len); 1093 beacon->len);
1088 1094
1089 if (ret < 0) { 1095 if (ret < 0) {
@@ -1091,7 +1097,7 @@ static void wl12xx_op_bss_info_changed(struct ieee80211_hw *hw,
1091 goto out; 1097 goto out;
1092 } 1098 }
1093 1099
1094 ret = wl12xx_cmd_template_set(wl, CMD_PROBE_RESP, beacon->data, 1100 ret = wl1251_cmd_template_set(wl, CMD_PROBE_RESP, beacon->data,
1095 beacon->len); 1101 beacon->len);
1096 1102
1097 dev_kfree_skb(beacon); 1103 dev_kfree_skb(beacon);
@@ -1106,7 +1112,7 @@ static void wl12xx_op_bss_info_changed(struct ieee80211_hw *hw,
1106 } 1112 }
1107 1113
1108out_sleep: 1114out_sleep:
1109 wl12xx_ps_elp_sleep(wl); 1115 wl1251_ps_elp_sleep(wl);
1110 1116
1111out: 1117out:
1112 mutex_unlock(&wl->mutex); 1118 mutex_unlock(&wl->mutex);
@@ -1114,7 +1120,7 @@ out:
1114 1120
1115 1121
1116/* can't be const, mac80211 writes to this */ 1122/* can't be const, mac80211 writes to this */
1117static struct ieee80211_rate wl12xx_rates[] = { 1123static struct ieee80211_rate wl1251_rates[] = {
1118 { .bitrate = 10, 1124 { .bitrate = 10,
1119 .hw_value = 0x1, 1125 .hw_value = 0x1,
1120 .hw_value_short = 0x1, }, 1126 .hw_value_short = 0x1, },
@@ -1157,7 +1163,7 @@ static struct ieee80211_rate wl12xx_rates[] = {
1157}; 1163};
1158 1164
1159/* can't be const, mac80211 writes to this */ 1165/* can't be const, mac80211 writes to this */
1160static struct ieee80211_channel wl12xx_channels[] = { 1166static struct ieee80211_channel wl1251_channels[] = {
1161 { .hw_value = 1, .center_freq = 2412}, 1167 { .hw_value = 1, .center_freq = 2412},
1162 { .hw_value = 2, .center_freq = 2417}, 1168 { .hw_value = 2, .center_freq = 2417},
1163 { .hw_value = 3, .center_freq = 2422}, 1169 { .hw_value = 3, .center_freq = 2422},
@@ -1174,28 +1180,28 @@ static struct ieee80211_channel wl12xx_channels[] = {
1174}; 1180};
1175 1181
1176/* can't be const, mac80211 writes to this */ 1182/* can't be const, mac80211 writes to this */
1177static struct ieee80211_supported_band wl12xx_band_2ghz = { 1183static struct ieee80211_supported_band wl1251_band_2ghz = {
1178 .channels = wl12xx_channels, 1184 .channels = wl1251_channels,
1179 .n_channels = ARRAY_SIZE(wl12xx_channels), 1185 .n_channels = ARRAY_SIZE(wl1251_channels),
1180 .bitrates = wl12xx_rates, 1186 .bitrates = wl1251_rates,
1181 .n_bitrates = ARRAY_SIZE(wl12xx_rates), 1187 .n_bitrates = ARRAY_SIZE(wl1251_rates),
1182}; 1188};
1183 1189
1184static const struct ieee80211_ops wl12xx_ops = { 1190static const struct ieee80211_ops wl1251_ops = {
1185 .start = wl12xx_op_start, 1191 .start = wl1251_op_start,
1186 .stop = wl12xx_op_stop, 1192 .stop = wl1251_op_stop,
1187 .add_interface = wl12xx_op_add_interface, 1193 .add_interface = wl1251_op_add_interface,
1188 .remove_interface = wl12xx_op_remove_interface, 1194 .remove_interface = wl1251_op_remove_interface,
1189 .config = wl12xx_op_config, 1195 .config = wl1251_op_config,
1190 .configure_filter = wl12xx_op_configure_filter, 1196 .configure_filter = wl1251_op_configure_filter,
1191 .tx = wl12xx_op_tx, 1197 .tx = wl1251_op_tx,
1192 .set_key = wl12xx_op_set_key, 1198 .set_key = wl1251_op_set_key,
1193 .hw_scan = wl12xx_op_hw_scan, 1199 .hw_scan = wl1251_op_hw_scan,
1194 .bss_info_changed = wl12xx_op_bss_info_changed, 1200 .bss_info_changed = wl1251_op_bss_info_changed,
1195 .set_rts_threshold = wl12xx_op_set_rts_threshold, 1201 .set_rts_threshold = wl1251_op_set_rts_threshold,
1196}; 1202};
1197 1203
1198static int wl12xx_register_hw(struct wl12xx *wl) 1204static int wl1251_register_hw(struct wl1251 *wl)
1199{ 1205{
1200 int ret; 1206 int ret;
1201 1207
@@ -1206,18 +1212,18 @@ static int wl12xx_register_hw(struct wl12xx *wl)
1206 1212
1207 ret = ieee80211_register_hw(wl->hw); 1213 ret = ieee80211_register_hw(wl->hw);
1208 if (ret < 0) { 1214 if (ret < 0) {
1209 wl12xx_error("unable to register mac80211 hw: %d", ret); 1215 wl1251_error("unable to register mac80211 hw: %d", ret);
1210 return ret; 1216 return ret;
1211 } 1217 }
1212 1218
1213 wl->mac80211_registered = true; 1219 wl->mac80211_registered = true;
1214 1220
1215 wl12xx_notice("loaded"); 1221 wl1251_notice("loaded");
1216 1222
1217 return 0; 1223 return 0;
1218} 1224}
1219 1225
1220static int wl12xx_init_ieee80211(struct wl12xx *wl) 1226static int wl1251_init_ieee80211(struct wl1251 *wl)
1221{ 1227{
1222 /* The tx descriptor buffer and the TKIP space */ 1228 /* The tx descriptor buffer and the TKIP space */
1223 wl->hw->extra_tx_headroom = sizeof(struct tx_double_buffer_desc) 1229 wl->hw->extra_tx_headroom = sizeof(struct tx_double_buffer_desc)
@@ -1232,31 +1238,31 @@ static int wl12xx_init_ieee80211(struct wl12xx *wl)
1232 1238
1233 wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); 1239 wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
1234 wl->hw->wiphy->max_scan_ssids = 1; 1240 wl->hw->wiphy->max_scan_ssids = 1;
1235 wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &wl12xx_band_2ghz; 1241 wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &wl1251_band_2ghz;
1236 1242
1237 SET_IEEE80211_DEV(wl->hw, &wl->spi->dev); 1243 SET_IEEE80211_DEV(wl->hw, &wl->spi->dev);
1238 1244
1239 return 0; 1245 return 0;
1240} 1246}
1241 1247
1242#define WL12XX_DEFAULT_CHANNEL 1 1248#define WL1251_DEFAULT_CHANNEL 1
1243static int __devinit wl12xx_probe(struct spi_device *spi) 1249static int __devinit wl1251_probe(struct spi_device *spi)
1244{ 1250{
1245 struct wl12xx_platform_data *pdata; 1251 struct wl12xx_platform_data *pdata;
1246 struct ieee80211_hw *hw; 1252 struct ieee80211_hw *hw;
1247 struct wl12xx *wl; 1253 struct wl1251 *wl;
1248 int ret, i; 1254 int ret, i;
1249 static const u8 nokia_oui[3] = {0x00, 0x1f, 0xdf}; 1255 static const u8 nokia_oui[3] = {0x00, 0x1f, 0xdf};
1250 1256
1251 pdata = spi->dev.platform_data; 1257 pdata = spi->dev.platform_data;
1252 if (!pdata) { 1258 if (!pdata) {
1253 wl12xx_error("no platform data"); 1259 wl1251_error("no platform data");
1254 return -ENODEV; 1260 return -ENODEV;
1255 } 1261 }
1256 1262
1257 hw = ieee80211_alloc_hw(sizeof(*wl), &wl12xx_ops); 1263 hw = ieee80211_alloc_hw(sizeof(*wl), &wl1251_ops);
1258 if (!hw) { 1264 if (!hw) {
1259 wl12xx_error("could not alloc ieee80211_hw"); 1265 wl1251_error("could not alloc ieee80211_hw");
1260 return -ENOMEM; 1266 return -ENOMEM;
1261 } 1267 }
1262 1268
@@ -1271,8 +1277,8 @@ static int __devinit wl12xx_probe(struct spi_device *spi)
1271 1277
1272 skb_queue_head_init(&wl->tx_queue); 1278 skb_queue_head_init(&wl->tx_queue);
1273 1279
1274 INIT_WORK(&wl->filter_work, wl12xx_filter_work); 1280 INIT_WORK(&wl->filter_work, wl1251_filter_work);
1275 wl->channel = WL12XX_DEFAULT_CHANNEL; 1281 wl->channel = WL1251_DEFAULT_CHANNEL;
1276 wl->scanning = false; 1282 wl->scanning = false;
1277 wl->default_key = 0; 1283 wl->default_key = 0;
1278 wl->listen_int = 1; 1284 wl->listen_int = 1;
@@ -1280,17 +1286,17 @@ static int __devinit wl12xx_probe(struct spi_device *spi)
1280 wl->rx_handled = 0; 1286 wl->rx_handled = 0;
1281 wl->rx_current_buffer = 0; 1287 wl->rx_current_buffer = 0;
1282 wl->rx_last_id = 0; 1288 wl->rx_last_id = 0;
1283 wl->rx_config = WL12XX_DEFAULT_RX_CONFIG; 1289 wl->rx_config = WL1251_DEFAULT_RX_CONFIG;
1284 wl->rx_filter = WL12XX_DEFAULT_RX_FILTER; 1290 wl->rx_filter = WL1251_DEFAULT_RX_FILTER;
1285 wl->elp = false; 1291 wl->elp = false;
1286 wl->psm = 0; 1292 wl->psm = 0;
1287 wl->psm_requested = false; 1293 wl->psm_requested = false;
1288 wl->tx_queue_stopped = false; 1294 wl->tx_queue_stopped = false;
1289 wl->power_level = WL12XX_DEFAULT_POWER_LEVEL; 1295 wl->power_level = WL1251_DEFAULT_POWER_LEVEL;
1290 1296
1291 /* We use the default power on sleep time until we know which chip 1297 /* We use the default power on sleep time until we know which chip
1292 * we're using */ 1298 * we're using */
1293 wl->chip.power_on_sleep = WL12XX_DEFAULT_POWER_ON_SLEEP; 1299 wl->chip.power_on_sleep = WL1251_DEFAULT_POWER_ON_SLEEP;
1294 1300
1295 for (i = 0; i < FW_TX_CMPLT_BLOCK_SIZE; i++) 1301 for (i = 0; i < FW_TX_CMPLT_BLOCK_SIZE; i++)
1296 wl->tx_frames[i] = NULL; 1302 wl->tx_frames[i] = NULL;
@@ -1304,7 +1310,7 @@ static int __devinit wl12xx_probe(struct spi_device *spi)
1304 memcpy(wl->mac_addr, nokia_oui, 3); 1310 memcpy(wl->mac_addr, nokia_oui, 3);
1305 get_random_bytes(wl->mac_addr + 3, 3); 1311 get_random_bytes(wl->mac_addr + 3, 3);
1306 1312
1307 wl->state = WL12XX_STATE_OFF; 1313 wl->state = WL1251_STATE_OFF;
1308 mutex_init(&wl->mutex); 1314 mutex_init(&wl->mutex);
1309 1315
1310 wl->tx_mgmt_frm_rate = DEFAULT_HW_GEN_TX_RATE; 1316 wl->tx_mgmt_frm_rate = DEFAULT_HW_GEN_TX_RATE;
@@ -1312,7 +1318,7 @@ static int __devinit wl12xx_probe(struct spi_device *spi)
1312 1318
1313 wl->rx_descriptor = kmalloc(sizeof(*wl->rx_descriptor), GFP_KERNEL); 1319 wl->rx_descriptor = kmalloc(sizeof(*wl->rx_descriptor), GFP_KERNEL);
1314 if (!wl->rx_descriptor) { 1320 if (!wl->rx_descriptor) {
1315 wl12xx_error("could not allocate memory for rx descriptor"); 1321 wl1251_error("could not allocate memory for rx descriptor");
1316 ret = -ENOMEM; 1322 ret = -ENOMEM;
1317 goto out_free; 1323 goto out_free;
1318 } 1324 }
@@ -1323,27 +1329,27 @@ static int __devinit wl12xx_probe(struct spi_device *spi)
1323 1329
1324 ret = spi_setup(spi); 1330 ret = spi_setup(spi);
1325 if (ret < 0) { 1331 if (ret < 0) {
1326 wl12xx_error("spi_setup failed"); 1332 wl1251_error("spi_setup failed");
1327 goto out_free; 1333 goto out_free;
1328 } 1334 }
1329 1335
1330 wl->set_power = pdata->set_power; 1336 wl->set_power = pdata->set_power;
1331 if (!wl->set_power) { 1337 if (!wl->set_power) {
1332 wl12xx_error("set power function missing in platform data"); 1338 wl1251_error("set power function missing in platform data");
1333 ret = -ENODEV; 1339 ret = -ENODEV;
1334 goto out_free; 1340 goto out_free;
1335 } 1341 }
1336 1342
1337 wl->irq = spi->irq; 1343 wl->irq = spi->irq;
1338 if (wl->irq < 0) { 1344 if (wl->irq < 0) {
1339 wl12xx_error("irq missing in platform data"); 1345 wl1251_error("irq missing in platform data");
1340 ret = -ENODEV; 1346 ret = -ENODEV;
1341 goto out_free; 1347 goto out_free;
1342 } 1348 }
1343 1349
1344 ret = request_irq(wl->irq, wl12xx_irq, 0, DRIVER_NAME, wl); 1350 ret = request_irq(wl->irq, wl1251_irq, 0, DRIVER_NAME, wl);
1345 if (ret < 0) { 1351 if (ret < 0) {
1346 wl12xx_error("request_irq() failed: %d", ret); 1352 wl1251_error("request_irq() failed: %d", ret);
1347 goto out_free; 1353 goto out_free;
1348 } 1354 }
1349 1355
@@ -1351,17 +1357,17 @@ static int __devinit wl12xx_probe(struct spi_device *spi)
1351 1357
1352 disable_irq(wl->irq); 1358 disable_irq(wl->irq);
1353 1359
1354 ret = wl12xx_init_ieee80211(wl); 1360 ret = wl1251_init_ieee80211(wl);
1355 if (ret) 1361 if (ret)
1356 goto out_irq; 1362 goto out_irq;
1357 1363
1358 ret = wl12xx_register_hw(wl); 1364 ret = wl1251_register_hw(wl);
1359 if (ret) 1365 if (ret)
1360 goto out_irq; 1366 goto out_irq;
1361 1367
1362 wl12xx_debugfs_init(wl); 1368 wl1251_debugfs_init(wl);
1363 1369
1364 wl12xx_notice("initialized"); 1370 wl1251_notice("initialized");
1365 1371
1366 return 0; 1372 return 0;
1367 1373
@@ -1377,13 +1383,13 @@ static int __devinit wl12xx_probe(struct spi_device *spi)
1377 return ret; 1383 return ret;
1378} 1384}
1379 1385
1380static int __devexit wl12xx_remove(struct spi_device *spi) 1386static int __devexit wl1251_remove(struct spi_device *spi)
1381{ 1387{
1382 struct wl12xx *wl = dev_get_drvdata(&spi->dev); 1388 struct wl1251 *wl = dev_get_drvdata(&spi->dev);
1383 1389
1384 ieee80211_unregister_hw(wl->hw); 1390 ieee80211_unregister_hw(wl->hw);
1385 1391
1386 wl12xx_debugfs_exit(wl); 1392 wl1251_debugfs_exit(wl);
1387 1393
1388 free_irq(wl->irq, wl); 1394 free_irq(wl->irq, wl);
1389 kfree(wl->target_mem_map); 1395 kfree(wl->target_mem_map);
@@ -1402,24 +1408,25 @@ static int __devexit wl12xx_remove(struct spi_device *spi)
1402} 1408}
1403 1409
1404 1410
1405static struct spi_driver wl12xx_spi_driver = { 1411static struct spi_driver wl1251_spi_driver = {
1406 .driver = { 1412 .driver = {
1413 /* FIXME: use wl12xx name to not break the user space */
1407 .name = "wl12xx", 1414 .name = "wl12xx",
1408 .bus = &spi_bus_type, 1415 .bus = &spi_bus_type,
1409 .owner = THIS_MODULE, 1416 .owner = THIS_MODULE,
1410 }, 1417 },
1411 1418
1412 .probe = wl12xx_probe, 1419 .probe = wl1251_probe,
1413 .remove = __devexit_p(wl12xx_remove), 1420 .remove = __devexit_p(wl1251_remove),
1414}; 1421};
1415 1422
1416static int __init wl12xx_init(void) 1423static int __init wl1251_init(void)
1417{ 1424{
1418 int ret; 1425 int ret;
1419 1426
1420 ret = spi_register_driver(&wl12xx_spi_driver); 1427 ret = spi_register_driver(&wl1251_spi_driver);
1421 if (ret < 0) { 1428 if (ret < 0) {
1422 wl12xx_error("failed to register spi driver: %d", ret); 1429 wl1251_error("failed to register spi driver: %d", ret);
1423 goto out; 1430 goto out;
1424 } 1431 }
1425 1432
@@ -1427,15 +1434,15 @@ out:
1427 return ret; 1434 return ret;
1428} 1435}
1429 1436
1430static void __exit wl12xx_exit(void) 1437static void __exit wl1251_exit(void)
1431{ 1438{
1432 spi_unregister_driver(&wl12xx_spi_driver); 1439 spi_unregister_driver(&wl1251_spi_driver);
1433 1440
1434 wl12xx_notice("unloaded"); 1441 wl1251_notice("unloaded");
1435} 1442}
1436 1443
1437module_init(wl12xx_init); 1444module_init(wl1251_init);
1438module_exit(wl12xx_exit); 1445module_exit(wl1251_exit);
1439 1446
1440MODULE_LICENSE("GPL"); 1447MODULE_LICENSE("GPL");
1441MODULE_AUTHOR("Kalle Valo <Kalle.Valo@nokia.com>, " 1448MODULE_AUTHOR("Kalle Valo <Kalle.Valo@nokia.com>, "
diff --git a/drivers/net/wireless/wl12xx/wl1251_netlink.c b/drivers/net/wireless/wl12xx/wl1251_netlink.c
index ca9a8567d58..67d3d5a3b51 100644
--- a/drivers/net/wireless/wl12xx/wl1251_netlink.c
+++ b/drivers/net/wireless/wl12xx/wl1251_netlink.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (C) 2008 Nokia Corporation 4 * Copyright (C) 2008 Nokia Corporation
5 * 5 *
@@ -35,52 +35,52 @@
35#include "wl1251_acx.h" 35#include "wl1251_acx.h"
36 36
37/* FIXME: this should be changed as soon as user space catches up */ 37/* FIXME: this should be changed as soon as user space catches up */
38#define WL12XX_NL_NAME "wl1251" 38#define WL1251_NL_NAME "wl1251"
39#define WL12XX_NL_VERSION 1 39#define WL1251_NL_VERSION 1
40 40
41#define WL12XX_MAX_TEST_LENGTH 1024 41#define WL1251_MAX_TEST_LENGTH 1024
42#define WL12XX_MAX_NVS_LENGTH 1024 42#define WL1251_MAX_NVS_LENGTH 1024
43 43
44enum wl12xx_nl_commands { 44enum wl1251_nl_commands {
45 WL12XX_NL_CMD_UNSPEC, 45 WL1251_NL_CMD_UNSPEC,
46 WL12XX_NL_CMD_TEST, 46 WL1251_NL_CMD_TEST,
47 WL12XX_NL_CMD_INTERROGATE, 47 WL1251_NL_CMD_INTERROGATE,
48 WL12XX_NL_CMD_CONFIGURE, 48 WL1251_NL_CMD_CONFIGURE,
49 WL12XX_NL_CMD_PHY_REG_READ, 49 WL1251_NL_CMD_PHY_REG_READ,
50 WL12XX_NL_CMD_NVS_PUSH, 50 WL1251_NL_CMD_NVS_PUSH,
51 WL12XX_NL_CMD_REG_WRITE, 51 WL1251_NL_CMD_REG_WRITE,
52 WL12XX_NL_CMD_REG_READ, 52 WL1251_NL_CMD_REG_READ,
53 WL12XX_NL_CMD_SET_PLT_MODE, 53 WL1251_NL_CMD_SET_PLT_MODE,
54 54
55 __WL12XX_NL_CMD_AFTER_LAST 55 __WL1251_NL_CMD_AFTER_LAST
56}; 56};
57#define WL12XX_NL_CMD_MAX (__WL12XX_NL_CMD_AFTER_LAST - 1) 57#define WL1251_NL_CMD_MAX (__WL1251_NL_CMD_AFTER_LAST - 1)
58 58
59enum wl12xx_nl_attrs { 59enum wl1251_nl_attrs {
60 WL12XX_NL_ATTR_UNSPEC, 60 WL1251_NL_ATTR_UNSPEC,
61 WL12XX_NL_ATTR_IFNAME, 61 WL1251_NL_ATTR_IFNAME,
62 WL12XX_NL_ATTR_CMD_TEST_PARAM, 62 WL1251_NL_ATTR_CMD_TEST_PARAM,
63 WL12XX_NL_ATTR_CMD_TEST_ANSWER, 63 WL1251_NL_ATTR_CMD_TEST_ANSWER,
64 WL12XX_NL_ATTR_CMD_IE, 64 WL1251_NL_ATTR_CMD_IE,
65 WL12XX_NL_ATTR_CMD_IE_LEN, 65 WL1251_NL_ATTR_CMD_IE_LEN,
66 WL12XX_NL_ATTR_CMD_IE_BUFFER, 66 WL1251_NL_ATTR_CMD_IE_BUFFER,
67 WL12XX_NL_ATTR_CMD_IE_ANSWER, 67 WL1251_NL_ATTR_CMD_IE_ANSWER,
68 WL12XX_NL_ATTR_REG_ADDR, 68 WL1251_NL_ATTR_REG_ADDR,
69 WL12XX_NL_ATTR_REG_VAL, 69 WL1251_NL_ATTR_REG_VAL,
70 WL12XX_NL_ATTR_NVS_BUFFER, 70 WL1251_NL_ATTR_NVS_BUFFER,
71 WL12XX_NL_ATTR_NVS_LEN, 71 WL1251_NL_ATTR_NVS_LEN,
72 WL12XX_NL_ATTR_PLT_MODE, 72 WL1251_NL_ATTR_PLT_MODE,
73 73
74 __WL12XX_NL_ATTR_AFTER_LAST 74 __WL1251_NL_ATTR_AFTER_LAST
75}; 75};
76#define WL12XX_NL_ATTR_MAX (__WL12XX_NL_ATTR_AFTER_LAST - 1) 76#define WL1251_NL_ATTR_MAX (__WL1251_NL_ATTR_AFTER_LAST - 1)
77 77
78static struct genl_family wl12xx_nl_family = { 78static struct genl_family wl1251_nl_family = {
79 .id = GENL_ID_GENERATE, 79 .id = GENL_ID_GENERATE,
80 .name = WL12XX_NL_NAME, 80 .name = WL1251_NL_NAME,
81 .hdrsize = 0, 81 .hdrsize = 0,
82 .version = WL12XX_NL_VERSION, 82 .version = WL1251_NL_VERSION,
83 .maxattr = WL12XX_NL_ATTR_MAX, 83 .maxattr = WL1251_NL_ATTR_MAX,
84}; 84};
85 85
86static struct net_device *ifname_to_netdev(struct net *net, 86static struct net_device *ifname_to_netdev(struct net *net,
@@ -88,17 +88,17 @@ static struct net_device *ifname_to_netdev(struct net *net,
88{ 88{
89 char *ifname; 89 char *ifname;
90 90
91 if (!info->attrs[WL12XX_NL_ATTR_IFNAME]) 91 if (!info->attrs[WL1251_NL_ATTR_IFNAME])
92 return NULL; 92 return NULL;
93 93
94 ifname = nla_data(info->attrs[WL12XX_NL_ATTR_IFNAME]); 94 ifname = nla_data(info->attrs[WL1251_NL_ATTR_IFNAME]);
95 95
96 wl12xx_debug(DEBUG_NETLINK, "Looking for %s", ifname); 96 wl1251_debug(DEBUG_NETLINK, "Looking for %s", ifname);
97 97
98 return dev_get_by_name(net, ifname); 98 return dev_get_by_name(net, ifname);
99} 99}
100 100
101static struct wl12xx *ifname_to_wl12xx(struct net *net, struct genl_info *info) 101static struct wl1251 *ifname_to_wl1251(struct net *net, struct genl_info *info)
102{ 102{
103 struct net_device *netdev; 103 struct net_device *netdev;
104 struct wireless_dev *wdev; 104 struct wireless_dev *wdev;
@@ -107,25 +107,25 @@ static struct wl12xx *ifname_to_wl12xx(struct net *net, struct genl_info *info)
107 107
108 netdev = ifname_to_netdev(net, info); 108 netdev = ifname_to_netdev(net, info);
109 if (netdev == NULL) { 109 if (netdev == NULL) {
110 wl12xx_error("Wrong interface"); 110 wl1251_error("Wrong interface");
111 return NULL; 111 return NULL;
112 } 112 }
113 113
114 wdev = netdev->ieee80211_ptr; 114 wdev = netdev->ieee80211_ptr;
115 if (wdev == NULL) { 115 if (wdev == NULL) {
116 wl12xx_error("ieee80211_ptr is NULL"); 116 wl1251_error("ieee80211_ptr is NULL");
117 return NULL; 117 return NULL;
118 } 118 }
119 119
120 wiphy = wdev->wiphy; 120 wiphy = wdev->wiphy;
121 if (wiphy == NULL) { 121 if (wiphy == NULL) {
122 wl12xx_error("wiphy is NULL"); 122 wl1251_error("wiphy is NULL");
123 return NULL; 123 return NULL;
124 } 124 }
125 125
126 hw = wiphy_priv(wiphy); 126 hw = wiphy_priv(wiphy);
127 if (hw == NULL) { 127 if (hw == NULL) {
128 wl12xx_error("hw is NULL"); 128 wl1251_error("hw is NULL");
129 return NULL; 129 return NULL;
130 } 130 }
131 131
@@ -134,20 +134,20 @@ static struct wl12xx *ifname_to_wl12xx(struct net *net, struct genl_info *info)
134 return hw->priv; 134 return hw->priv;
135} 135}
136 136
137static int wl12xx_nl_test_cmd(struct sk_buff *skb, struct genl_info *info) 137static int wl1251_nl_test_cmd(struct sk_buff *skb, struct genl_info *info)
138{ 138{
139 struct wl12xx *wl; 139 struct wl1251 *wl;
140 struct wl12xx_command *cmd; 140 struct wl1251_command *cmd;
141 char *buf; 141 char *buf;
142 int buf_len, ret, cmd_len; 142 int buf_len, ret, cmd_len;
143 u8 answer; 143 u8 answer;
144 144
145 if (!info->attrs[WL12XX_NL_ATTR_CMD_TEST_PARAM]) 145 if (!info->attrs[WL1251_NL_ATTR_CMD_TEST_PARAM])
146 return -EINVAL; 146 return -EINVAL;
147 147
148 wl = ifname_to_wl12xx(&init_net, info); 148 wl = ifname_to_wl1251(&init_net, info);
149 if (wl == NULL) { 149 if (wl == NULL) {
150 wl12xx_error("wl12xx not found"); 150 wl1251_error("wl1251 not found");
151 return -EINVAL; 151 return -EINVAL;
152 } 152 }
153 153
@@ -155,20 +155,20 @@ static int wl12xx_nl_test_cmd(struct sk_buff *skb, struct genl_info *info)
155 if (!cmd) 155 if (!cmd)
156 return -ENOMEM; 156 return -ENOMEM;
157 157
158 buf = nla_data(info->attrs[WL12XX_NL_ATTR_CMD_TEST_PARAM]); 158 buf = nla_data(info->attrs[WL1251_NL_ATTR_CMD_TEST_PARAM]);
159 buf_len = nla_len(info->attrs[WL12XX_NL_ATTR_CMD_TEST_PARAM]); 159 buf_len = nla_len(info->attrs[WL1251_NL_ATTR_CMD_TEST_PARAM]);
160 answer = nla_get_u8(info->attrs[WL12XX_NL_ATTR_CMD_TEST_ANSWER]); 160 answer = nla_get_u8(info->attrs[WL1251_NL_ATTR_CMD_TEST_ANSWER]);
161 161
162 cmd->header.id = CMD_TEST; 162 cmd->header.id = CMD_TEST;
163 memcpy(cmd->parameters, buf, buf_len); 163 memcpy(cmd->parameters, buf, buf_len);
164 cmd_len = sizeof(struct wl12xx_cmd_header) + buf_len; 164 cmd_len = sizeof(struct wl1251_cmd_header) + buf_len;
165 165
166 mutex_lock(&wl->mutex); 166 mutex_lock(&wl->mutex);
167 ret = wl12xx_cmd_test(wl, cmd, cmd_len, answer); 167 ret = wl1251_cmd_test(wl, cmd, cmd_len, answer);
168 mutex_unlock(&wl->mutex); 168 mutex_unlock(&wl->mutex);
169 169
170 if (ret < 0) { 170 if (ret < 0) {
171 wl12xx_error("%s() failed", __func__); 171 wl1251_error("%s() failed", __func__);
172 goto out; 172 goto out;
173 } 173 }
174 174
@@ -183,49 +183,49 @@ static int wl12xx_nl_test_cmd(struct sk_buff *skb, struct genl_info *info)
183 } 183 }
184 184
185 hdr = genlmsg_put(msg, info->snd_pid, info->snd_seq, 185 hdr = genlmsg_put(msg, info->snd_pid, info->snd_seq,
186 &wl12xx_nl_family, 0, WL12XX_NL_CMD_TEST); 186 &wl1251_nl_family, 0, WL1251_NL_CMD_TEST);
187 if (IS_ERR(hdr)) { 187 if (IS_ERR(hdr)) {
188 ret = PTR_ERR(hdr); 188 ret = PTR_ERR(hdr);
189 goto nla_put_failure; 189 goto nla_put_failure;
190 } 190 }
191 191
192 NLA_PUT_STRING(msg, WL12XX_NL_ATTR_IFNAME, 192 NLA_PUT_STRING(msg, WL1251_NL_ATTR_IFNAME,
193 nla_data(info->attrs[WL12XX_NL_ATTR_IFNAME])); 193 nla_data(info->attrs[WL1251_NL_ATTR_IFNAME]));
194 NLA_PUT(msg, WL12XX_NL_ATTR_CMD_TEST_ANSWER, 194 NLA_PUT(msg, WL1251_NL_ATTR_CMD_TEST_ANSWER,
195 sizeof(*cmd), cmd); 195 sizeof(*cmd), cmd);
196 196
197 ret = genlmsg_end(msg, hdr); 197 ret = genlmsg_end(msg, hdr);
198 if (ret < 0) { 198 if (ret < 0) {
199 wl12xx_error("%s() failed", __func__); 199 wl1251_error("%s() failed", __func__);
200 goto nla_put_failure; 200 goto nla_put_failure;
201 } 201 }
202 202
203 wl12xx_debug(DEBUG_NETLINK, "TEST cmd sent, answer"); 203 wl1251_debug(DEBUG_NETLINK, "TEST cmd sent, answer");
204 ret = genlmsg_reply(msg, info); 204 ret = genlmsg_reply(msg, info);
205 goto out; 205 goto out;
206 206
207 nla_put_failure: 207 nla_put_failure:
208 nlmsg_free(msg); 208 nlmsg_free(msg);
209 } else 209 } else
210 wl12xx_debug(DEBUG_NETLINK, "TEST cmd sent"); 210 wl1251_debug(DEBUG_NETLINK, "TEST cmd sent");
211 211
212out: 212out:
213 kfree(cmd); 213 kfree(cmd);
214 return ret; 214 return ret;
215} 215}
216 216
217static int wl12xx_nl_interrogate(struct sk_buff *skb, struct genl_info *info) 217static int wl1251_nl_interrogate(struct sk_buff *skb, struct genl_info *info)
218{ 218{
219 struct wl12xx *wl; 219 struct wl1251 *wl;
220 struct sk_buff *msg; 220 struct sk_buff *msg;
221 int ret = -ENOBUFS, cmd_ie, cmd_ie_len; 221 int ret = -ENOBUFS, cmd_ie, cmd_ie_len;
222 struct wl12xx_command *cmd; 222 struct wl1251_command *cmd;
223 void *hdr; 223 void *hdr;
224 224
225 if (!info->attrs[WL12XX_NL_ATTR_CMD_IE]) 225 if (!info->attrs[WL1251_NL_ATTR_CMD_IE])
226 return -EINVAL; 226 return -EINVAL;
227 227
228 if (!info->attrs[WL12XX_NL_ATTR_CMD_IE_LEN]) 228 if (!info->attrs[WL1251_NL_ATTR_CMD_IE_LEN])
229 return -EINVAL; 229 return -EINVAL;
230 230
231 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); 231 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
@@ -236,45 +236,45 @@ static int wl12xx_nl_interrogate(struct sk_buff *skb, struct genl_info *info)
236 if (!msg) 236 if (!msg)
237 return -ENOMEM; 237 return -ENOMEM;
238 238
239 wl = ifname_to_wl12xx(&init_net, info); 239 wl = ifname_to_wl1251(&init_net, info);
240 if (wl == NULL) { 240 if (wl == NULL) {
241 wl12xx_error("wl12xx not found"); 241 wl1251_error("wl1251 not found");
242 ret = -EINVAL; 242 ret = -EINVAL;
243 goto nla_put_failure; 243 goto nla_put_failure;
244 } 244 }
245 245
246 /* acx id */ 246 /* acx id */
247 cmd_ie = nla_get_u32(info->attrs[WL12XX_NL_ATTR_CMD_IE]); 247 cmd_ie = nla_get_u32(info->attrs[WL1251_NL_ATTR_CMD_IE]);
248 248
249 /* maximum length of acx, including all headers */ 249 /* maximum length of acx, including all headers */
250 cmd_ie_len = nla_get_u32(info->attrs[WL12XX_NL_ATTR_CMD_IE_LEN]); 250 cmd_ie_len = nla_get_u32(info->attrs[WL1251_NL_ATTR_CMD_IE_LEN]);
251 251
252 wl12xx_debug(DEBUG_NETLINK, "Getting IE 0x%x (len %d)", 252 wl1251_debug(DEBUG_NETLINK, "Getting IE 0x%x (len %d)",
253 cmd_ie, cmd_ie_len); 253 cmd_ie, cmd_ie_len);
254 254
255 mutex_lock(&wl->mutex); 255 mutex_lock(&wl->mutex);
256 ret = wl12xx_cmd_interrogate(wl, cmd_ie, cmd, cmd_ie_len); 256 ret = wl1251_cmd_interrogate(wl, cmd_ie, cmd, cmd_ie_len);
257 mutex_unlock(&wl->mutex); 257 mutex_unlock(&wl->mutex);
258 258
259 if (ret < 0) { 259 if (ret < 0) {
260 wl12xx_error("%s() failed", __func__); 260 wl1251_error("%s() failed", __func__);
261 goto nla_put_failure; 261 goto nla_put_failure;
262 } 262 }
263 263
264 hdr = genlmsg_put(msg, info->snd_pid, info->snd_seq, 264 hdr = genlmsg_put(msg, info->snd_pid, info->snd_seq,
265 &wl12xx_nl_family, 0, WL12XX_NL_CMD_INTERROGATE); 265 &wl1251_nl_family, 0, WL1251_NL_CMD_INTERROGATE);
266 if (IS_ERR(hdr)) { 266 if (IS_ERR(hdr)) {
267 ret = PTR_ERR(hdr); 267 ret = PTR_ERR(hdr);
268 goto nla_put_failure; 268 goto nla_put_failure;
269 } 269 }
270 270
271 NLA_PUT_STRING(msg, WL12XX_NL_ATTR_IFNAME, 271 NLA_PUT_STRING(msg, WL1251_NL_ATTR_IFNAME,
272 nla_data(info->attrs[WL12XX_NL_ATTR_IFNAME])); 272 nla_data(info->attrs[WL1251_NL_ATTR_IFNAME]));
273 NLA_PUT(msg, WL12XX_NL_ATTR_CMD_IE_ANSWER, cmd_ie_len, cmd); 273 NLA_PUT(msg, WL1251_NL_ATTR_CMD_IE_ANSWER, cmd_ie_len, cmd);
274 274
275 ret = genlmsg_end(msg, hdr); 275 ret = genlmsg_end(msg, hdr);
276 if (ret < 0) { 276 if (ret < 0) {
277 wl12xx_error("%s() failed", __func__); 277 wl1251_error("%s() failed", __func__);
278 goto nla_put_failure; 278 goto nla_put_failure;
279 } 279 }
280 280
@@ -288,36 +288,36 @@ static int wl12xx_nl_interrogate(struct sk_buff *skb, struct genl_info *info)
288 return ret; 288 return ret;
289} 289}
290 290
291static int wl12xx_nl_configure(struct sk_buff *skb, struct genl_info *info) 291static int wl1251_nl_configure(struct sk_buff *skb, struct genl_info *info)
292{ 292{
293 int ret = 0, cmd_ie_len, acx_len; 293 int ret = 0, cmd_ie_len, acx_len;
294 struct acx_header *acx = NULL; 294 struct acx_header *acx = NULL;
295 struct sk_buff *msg; 295 struct sk_buff *msg;
296 struct wl12xx *wl; 296 struct wl1251 *wl;
297 void *cmd_ie; 297 void *cmd_ie;
298 u16 *id; 298 u16 *id;
299 299
300 if (!info->attrs[WL12XX_NL_ATTR_CMD_IE_BUFFER]) 300 if (!info->attrs[WL1251_NL_ATTR_CMD_IE_BUFFER])
301 return -EINVAL; 301 return -EINVAL;
302 302
303 if (!info->attrs[WL12XX_NL_ATTR_CMD_IE_LEN]) 303 if (!info->attrs[WL1251_NL_ATTR_CMD_IE_LEN])
304 return -EINVAL; 304 return -EINVAL;
305 305
306 msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); 306 msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
307 if (!msg) 307 if (!msg)
308 return -ENOMEM; 308 return -ENOMEM;
309 309
310 wl = ifname_to_wl12xx(&init_net, info); 310 wl = ifname_to_wl1251(&init_net, info);
311 if (wl == NULL) { 311 if (wl == NULL) {
312 wl12xx_error("wl12xx not found"); 312 wl1251_error("wl1251 not found");
313 ret = -EINVAL; 313 ret = -EINVAL;
314 goto nla_put_failure; 314 goto nla_put_failure;
315 } 315 }
316 316
317 /* contains the acx header but not the cmd header */ 317 /* contains the acx header but not the cmd header */
318 cmd_ie = nla_data(info->attrs[WL12XX_NL_ATTR_CMD_IE_BUFFER]); 318 cmd_ie = nla_data(info->attrs[WL1251_NL_ATTR_CMD_IE_BUFFER]);
319 319
320 cmd_ie_len = nla_get_u32(info->attrs[WL12XX_NL_ATTR_CMD_IE_LEN]); 320 cmd_ie_len = nla_get_u32(info->attrs[WL1251_NL_ATTR_CMD_IE_LEN]);
321 321
322 /* acx id is in the first two bytes */ 322 /* acx id is in the first two bytes */
323 id = cmd_ie; 323 id = cmd_ie;
@@ -334,15 +334,15 @@ static int wl12xx_nl_configure(struct sk_buff *skb, struct genl_info *info)
334 memcpy(&acx->id, cmd_ie, cmd_ie_len); 334 memcpy(&acx->id, cmd_ie, cmd_ie_len);
335 335
336 mutex_lock(&wl->mutex); 336 mutex_lock(&wl->mutex);
337 ret = wl12xx_cmd_configure(wl, *id, acx, acx_len); 337 ret = wl1251_cmd_configure(wl, *id, acx, acx_len);
338 mutex_unlock(&wl->mutex); 338 mutex_unlock(&wl->mutex);
339 339
340 if (ret < 0) { 340 if (ret < 0) {
341 wl12xx_error("%s() failed", __func__); 341 wl1251_error("%s() failed", __func__);
342 goto nla_put_failure; 342 goto nla_put_failure;
343 } 343 }
344 344
345 wl12xx_debug(DEBUG_NETLINK, "CONFIGURE cmd sent"); 345 wl1251_debug(DEBUG_NETLINK, "CONFIGURE cmd sent");
346 346
347 nla_put_failure: 347 nla_put_failure:
348 kfree(acx); 348 kfree(acx);
@@ -351,24 +351,24 @@ static int wl12xx_nl_configure(struct sk_buff *skb, struct genl_info *info)
351 return ret; 351 return ret;
352} 352}
353 353
354static int wl12xx_nl_phy_reg_read(struct sk_buff *skb, struct genl_info *info) 354static int wl1251_nl_phy_reg_read(struct sk_buff *skb, struct genl_info *info)
355{ 355{
356 struct wl12xx *wl; 356 struct wl1251 *wl;
357 struct sk_buff *msg; 357 struct sk_buff *msg;
358 u32 reg_addr, *reg_value = NULL; 358 u32 reg_addr, *reg_value = NULL;
359 int ret = 0; 359 int ret = 0;
360 void *hdr; 360 void *hdr;
361 361
362 if (!info->attrs[WL12XX_NL_ATTR_REG_ADDR]) 362 if (!info->attrs[WL1251_NL_ATTR_REG_ADDR])
363 return -EINVAL; 363 return -EINVAL;
364 364
365 msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); 365 msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
366 if (!msg) 366 if (!msg)
367 return -ENOMEM; 367 return -ENOMEM;
368 368
369 wl = ifname_to_wl12xx(&init_net, info); 369 wl = ifname_to_wl1251(&init_net, info);
370 if (wl == NULL) { 370 if (wl == NULL) {
371 wl12xx_error("wl12xx not found"); 371 wl1251_error("wl1251 not found");
372 ret = -EINVAL; 372 ret = -EINVAL;
373 goto nla_put_failure; 373 goto nla_put_failure;
374 } 374 }
@@ -379,36 +379,36 @@ static int wl12xx_nl_phy_reg_read(struct sk_buff *skb, struct genl_info *info)
379 goto nla_put_failure; 379 goto nla_put_failure;
380 } 380 }
381 381
382 reg_addr = nla_get_u32(info->attrs[WL12XX_NL_ATTR_REG_ADDR]); 382 reg_addr = nla_get_u32(info->attrs[WL1251_NL_ATTR_REG_ADDR]);
383 383
384 wl12xx_debug(DEBUG_NETLINK, "Reading PHY reg 0x%x", reg_addr); 384 wl1251_debug(DEBUG_NETLINK, "Reading PHY reg 0x%x", reg_addr);
385 385
386 mutex_lock(&wl->mutex); 386 mutex_lock(&wl->mutex);
387 ret = wl12xx_cmd_read_memory(wl, reg_addr, reg_value, 387 ret = wl1251_cmd_read_memory(wl, reg_addr, reg_value,
388 sizeof(*reg_value)); 388 sizeof(*reg_value));
389 mutex_unlock(&wl->mutex); 389 mutex_unlock(&wl->mutex);
390 390
391 if (ret < 0) { 391 if (ret < 0) {
392 wl12xx_error("%s() failed", __func__); 392 wl1251_error("%s() failed", __func__);
393 goto nla_put_failure; 393 goto nla_put_failure;
394 } 394 }
395 395
396 396
397 hdr = genlmsg_put(msg, info->snd_pid, info->snd_seq, 397 hdr = genlmsg_put(msg, info->snd_pid, info->snd_seq,
398 &wl12xx_nl_family, 0, WL12XX_NL_CMD_PHY_REG_READ); 398 &wl1251_nl_family, 0, WL1251_NL_CMD_PHY_REG_READ);
399 if (IS_ERR(hdr)) { 399 if (IS_ERR(hdr)) {
400 ret = PTR_ERR(hdr); 400 ret = PTR_ERR(hdr);
401 goto nla_put_failure; 401 goto nla_put_failure;
402 } 402 }
403 403
404 NLA_PUT_STRING(msg, WL12XX_NL_ATTR_IFNAME, 404 NLA_PUT_STRING(msg, WL1251_NL_ATTR_IFNAME,
405 nla_data(info->attrs[WL12XX_NL_ATTR_IFNAME])); 405 nla_data(info->attrs[WL1251_NL_ATTR_IFNAME]));
406 406
407 NLA_PUT_U32(msg, WL12XX_NL_ATTR_REG_VAL, *reg_value); 407 NLA_PUT_U32(msg, WL1251_NL_ATTR_REG_VAL, *reg_value);
408 408
409 ret = genlmsg_end(msg, hdr); 409 ret = genlmsg_end(msg, hdr);
410 if (ret < 0) { 410 if (ret < 0) {
411 wl12xx_error("%s() failed", __func__); 411 wl1251_error("%s() failed", __func__);
412 goto nla_put_failure; 412 goto nla_put_failure;
413 } 413 }
414 414
@@ -423,27 +423,27 @@ static int wl12xx_nl_phy_reg_read(struct sk_buff *skb, struct genl_info *info)
423 return ret; 423 return ret;
424} 424}
425 425
426static int wl12xx_nl_nvs_push(struct sk_buff *skb, struct genl_info *info) 426static int wl1251_nl_nvs_push(struct sk_buff *skb, struct genl_info *info)
427{ 427{
428 struct wl12xx *wl; 428 struct wl1251 *wl;
429 int ret = 0; 429 int ret = 0;
430 430
431 if (!info->attrs[WL12XX_NL_ATTR_NVS_BUFFER]) 431 if (!info->attrs[WL1251_NL_ATTR_NVS_BUFFER])
432 return -EINVAL; 432 return -EINVAL;
433 433
434 if (!info->attrs[WL12XX_NL_ATTR_NVS_LEN]) 434 if (!info->attrs[WL1251_NL_ATTR_NVS_LEN])
435 return -EINVAL; 435 return -EINVAL;
436 436
437 wl = ifname_to_wl12xx(&init_net, info); 437 wl = ifname_to_wl1251(&init_net, info);
438 if (wl == NULL) { 438 if (wl == NULL) {
439 wl12xx_error("wl12xx not found"); 439 wl1251_error("wl1251 not found");
440 return -EINVAL; 440 return -EINVAL;
441 } 441 }
442 442
443 mutex_lock(&wl->mutex); 443 mutex_lock(&wl->mutex);
444 wl->nvs_len = nla_get_u32(info->attrs[WL12XX_NL_ATTR_NVS_LEN]); 444 wl->nvs_len = nla_get_u32(info->attrs[WL1251_NL_ATTR_NVS_LEN]);
445 if (wl->nvs_len % 4) { 445 if (wl->nvs_len % 4) {
446 wl12xx_error("NVS size is not multiple of 32: %d", wl->nvs_len); 446 wl1251_error("NVS size is not multiple of 32: %d", wl->nvs_len);
447 ret = -EILSEQ; 447 ret = -EILSEQ;
448 goto out; 448 goto out;
449 } 449 }
@@ -453,16 +453,16 @@ static int wl12xx_nl_nvs_push(struct sk_buff *skb, struct genl_info *info)
453 453
454 wl->nvs = kzalloc(wl->nvs_len, GFP_KERNEL); 454 wl->nvs = kzalloc(wl->nvs_len, GFP_KERNEL);
455 if (wl->nvs == NULL) { 455 if (wl->nvs == NULL) {
456 wl12xx_error("Can't allocate NVS"); 456 wl1251_error("Can't allocate NVS");
457 ret = -ENOMEM; 457 ret = -ENOMEM;
458 goto out; 458 goto out;
459 } 459 }
460 460
461 memcpy(wl->nvs, 461 memcpy(wl->nvs,
462 nla_data(info->attrs[WL12XX_NL_ATTR_NVS_BUFFER]), 462 nla_data(info->attrs[WL1251_NL_ATTR_NVS_BUFFER]),
463 wl->nvs_len); 463 wl->nvs_len);
464 464
465 wl12xx_debug(DEBUG_NETLINK, "got NVS from userspace, %d bytes", 465 wl1251_debug(DEBUG_NETLINK, "got NVS from userspace, %d bytes",
466 wl->nvs_len); 466 wl->nvs_len);
467 467
468out: 468out:
@@ -471,48 +471,48 @@ out:
471 return ret; 471 return ret;
472} 472}
473 473
474static int wl12xx_nl_reg_read(struct sk_buff *skb, struct genl_info *info) 474static int wl1251_nl_reg_read(struct sk_buff *skb, struct genl_info *info)
475{ 475{
476 struct wl12xx *wl; 476 struct wl1251 *wl;
477 u32 addr, val; 477 u32 addr, val;
478 int ret = 0; 478 int ret = 0;
479 struct sk_buff *msg; 479 struct sk_buff *msg;
480 void *hdr; 480 void *hdr;
481 481
482 if (!info->attrs[WL12XX_NL_ATTR_REG_ADDR]) 482 if (!info->attrs[WL1251_NL_ATTR_REG_ADDR])
483 return -EINVAL; 483 return -EINVAL;
484 484
485 msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); 485 msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
486 if (!msg) 486 if (!msg)
487 return -ENOMEM; 487 return -ENOMEM;
488 488
489 wl = ifname_to_wl12xx(&init_net, info); 489 wl = ifname_to_wl1251(&init_net, info);
490 if (wl == NULL) { 490 if (wl == NULL) {
491 wl12xx_error("wl12xx not found"); 491 wl1251_error("wl1251 not found");
492 return -EINVAL; 492 return -EINVAL;
493 } 493 }
494 494
495 addr = nla_get_u32(info->attrs[WL12XX_NL_ATTR_REG_ADDR]); 495 addr = nla_get_u32(info->attrs[WL1251_NL_ATTR_REG_ADDR]);
496 496
497 mutex_lock(&wl->mutex); 497 mutex_lock(&wl->mutex);
498 val = wl12xx_reg_read32(wl, addr); 498 val = wl1251_reg_read32(wl, addr);
499 mutex_unlock(&wl->mutex); 499 mutex_unlock(&wl->mutex);
500 500
501 hdr = genlmsg_put(msg, info->snd_pid, info->snd_seq, 501 hdr = genlmsg_put(msg, info->snd_pid, info->snd_seq,
502 &wl12xx_nl_family, 0, WL12XX_NL_CMD_PHY_REG_READ); 502 &wl1251_nl_family, 0, WL1251_NL_CMD_PHY_REG_READ);
503 if (IS_ERR(hdr)) { 503 if (IS_ERR(hdr)) {
504 ret = PTR_ERR(hdr); 504 ret = PTR_ERR(hdr);
505 goto nla_put_failure; 505 goto nla_put_failure;
506 } 506 }
507 507
508 NLA_PUT_STRING(msg, WL12XX_NL_ATTR_IFNAME, 508 NLA_PUT_STRING(msg, WL1251_NL_ATTR_IFNAME,
509 nla_data(info->attrs[WL12XX_NL_ATTR_IFNAME])); 509 nla_data(info->attrs[WL1251_NL_ATTR_IFNAME]));
510 510
511 NLA_PUT_U32(msg, WL12XX_NL_ATTR_REG_VAL, val); 511 NLA_PUT_U32(msg, WL1251_NL_ATTR_REG_VAL, val);
512 512
513 ret = genlmsg_end(msg, hdr); 513 ret = genlmsg_end(msg, hdr);
514 if (ret < 0) { 514 if (ret < 0) {
515 wl12xx_error("%s() failed", __func__); 515 wl1251_error("%s() failed", __func__);
516 goto nla_put_failure; 516 goto nla_put_failure;
517 } 517 }
518 518
@@ -524,56 +524,56 @@ static int wl12xx_nl_reg_read(struct sk_buff *skb, struct genl_info *info)
524 return ret; 524 return ret;
525} 525}
526 526
527static int wl12xx_nl_reg_write(struct sk_buff *skb, struct genl_info *info) 527static int wl1251_nl_reg_write(struct sk_buff *skb, struct genl_info *info)
528{ 528{
529 struct wl12xx *wl; 529 struct wl1251 *wl;
530 u32 addr, val; 530 u32 addr, val;
531 531
532 if (!info->attrs[WL12XX_NL_ATTR_REG_ADDR]) 532 if (!info->attrs[WL1251_NL_ATTR_REG_ADDR])
533 return -EINVAL; 533 return -EINVAL;
534 534
535 if (!info->attrs[WL12XX_NL_ATTR_REG_VAL]) 535 if (!info->attrs[WL1251_NL_ATTR_REG_VAL])
536 return -EINVAL; 536 return -EINVAL;
537 537
538 wl = ifname_to_wl12xx(&init_net, info); 538 wl = ifname_to_wl1251(&init_net, info);
539 if (wl == NULL) { 539 if (wl == NULL) {
540 wl12xx_error("wl12xx not found"); 540 wl1251_error("wl1251 not found");
541 return -EINVAL; 541 return -EINVAL;
542 } 542 }
543 543
544 addr = nla_get_u32(info->attrs[WL12XX_NL_ATTR_REG_ADDR]); 544 addr = nla_get_u32(info->attrs[WL1251_NL_ATTR_REG_ADDR]);
545 val = nla_get_u32(info->attrs[WL12XX_NL_ATTR_REG_VAL]); 545 val = nla_get_u32(info->attrs[WL1251_NL_ATTR_REG_VAL]);
546 546
547 mutex_lock(&wl->mutex); 547 mutex_lock(&wl->mutex);
548 wl12xx_reg_write32(wl, addr, val); 548 wl1251_reg_write32(wl, addr, val);
549 mutex_unlock(&wl->mutex); 549 mutex_unlock(&wl->mutex);
550 550
551 return 0; 551 return 0;
552} 552}
553 553
554static int wl12xx_nl_set_plt_mode(struct sk_buff *skb, struct genl_info *info) 554static int wl1251_nl_set_plt_mode(struct sk_buff *skb, struct genl_info *info)
555{ 555{
556 struct wl12xx *wl; 556 struct wl1251 *wl;
557 u32 val; 557 u32 val;
558 int ret; 558 int ret;
559 559
560 if (!info->attrs[WL12XX_NL_ATTR_PLT_MODE]) 560 if (!info->attrs[WL1251_NL_ATTR_PLT_MODE])
561 return -EINVAL; 561 return -EINVAL;
562 562
563 wl = ifname_to_wl12xx(&init_net, info); 563 wl = ifname_to_wl1251(&init_net, info);
564 if (wl == NULL) { 564 if (wl == NULL) {
565 wl12xx_error("wl12xx not found"); 565 wl1251_error("wl1251 not found");
566 return -EINVAL; 566 return -EINVAL;
567 } 567 }
568 568
569 val = nla_get_u32(info->attrs[WL12XX_NL_ATTR_PLT_MODE]); 569 val = nla_get_u32(info->attrs[WL1251_NL_ATTR_PLT_MODE]);
570 570
571 switch (val) { 571 switch (val) {
572 case 0: 572 case 0:
573 ret = wl12xx_plt_stop(wl); 573 ret = wl1251_plt_stop(wl);
574 break; 574 break;
575 case 1: 575 case 1:
576 ret = wl12xx_plt_start(wl); 576 ret = wl1251_plt_start(wl);
577 break; 577 break;
578 default: 578 default:
579 ret = -EINVAL; 579 ret = -EINVAL;
@@ -583,97 +583,97 @@ static int wl12xx_nl_set_plt_mode(struct sk_buff *skb, struct genl_info *info)
583 return ret; 583 return ret;
584} 584}
585 585
586static struct nla_policy wl12xx_nl_policy[WL12XX_NL_ATTR_MAX + 1] = { 586static struct nla_policy wl1251_nl_policy[WL1251_NL_ATTR_MAX + 1] = {
587 [WL12XX_NL_ATTR_IFNAME] = { .type = NLA_NUL_STRING, 587 [WL1251_NL_ATTR_IFNAME] = { .type = NLA_NUL_STRING,
588 .len = IFNAMSIZ-1 }, 588 .len = IFNAMSIZ-1 },
589 [WL12XX_NL_ATTR_CMD_TEST_PARAM] = { .type = NLA_BINARY, 589 [WL1251_NL_ATTR_CMD_TEST_PARAM] = { .type = NLA_BINARY,
590 .len = WL12XX_MAX_TEST_LENGTH }, 590 .len = WL1251_MAX_TEST_LENGTH },
591 [WL12XX_NL_ATTR_CMD_TEST_ANSWER] = { .type = NLA_U8 }, 591 [WL1251_NL_ATTR_CMD_TEST_ANSWER] = { .type = NLA_U8 },
592 [WL12XX_NL_ATTR_CMD_IE] = { .type = NLA_U32 }, 592 [WL1251_NL_ATTR_CMD_IE] = { .type = NLA_U32 },
593 [WL12XX_NL_ATTR_CMD_IE_LEN] = { .type = NLA_U32 }, 593 [WL1251_NL_ATTR_CMD_IE_LEN] = { .type = NLA_U32 },
594 [WL12XX_NL_ATTR_CMD_IE_BUFFER] = { .type = NLA_BINARY, 594 [WL1251_NL_ATTR_CMD_IE_BUFFER] = { .type = NLA_BINARY,
595 .len = WL12XX_MAX_TEST_LENGTH }, 595 .len = WL1251_MAX_TEST_LENGTH },
596 [WL12XX_NL_ATTR_CMD_IE_ANSWER] = { .type = NLA_BINARY, 596 [WL1251_NL_ATTR_CMD_IE_ANSWER] = { .type = NLA_BINARY,
597 .len = WL12XX_MAX_TEST_LENGTH }, 597 .len = WL1251_MAX_TEST_LENGTH },
598 [WL12XX_NL_ATTR_REG_ADDR] = { .type = NLA_U32 }, 598 [WL1251_NL_ATTR_REG_ADDR] = { .type = NLA_U32 },
599 [WL12XX_NL_ATTR_REG_VAL] = { .type = NLA_U32 }, 599 [WL1251_NL_ATTR_REG_VAL] = { .type = NLA_U32 },
600 [WL12XX_NL_ATTR_NVS_BUFFER] = { .type = NLA_BINARY, 600 [WL1251_NL_ATTR_NVS_BUFFER] = { .type = NLA_BINARY,
601 .len = WL12XX_MAX_NVS_LENGTH }, 601 .len = WL1251_MAX_NVS_LENGTH },
602 [WL12XX_NL_ATTR_NVS_LEN] = { .type = NLA_U32 }, 602 [WL1251_NL_ATTR_NVS_LEN] = { .type = NLA_U32 },
603 [WL12XX_NL_ATTR_PLT_MODE] = { .type = NLA_U32 }, 603 [WL1251_NL_ATTR_PLT_MODE] = { .type = NLA_U32 },
604}; 604};
605 605
606static struct genl_ops wl12xx_nl_ops[] = { 606static struct genl_ops wl1251_nl_ops[] = {
607 { 607 {
608 .cmd = WL12XX_NL_CMD_TEST, 608 .cmd = WL1251_NL_CMD_TEST,
609 .doit = wl12xx_nl_test_cmd, 609 .doit = wl1251_nl_test_cmd,
610 .policy = wl12xx_nl_policy, 610 .policy = wl1251_nl_policy,
611 .flags = GENL_ADMIN_PERM, 611 .flags = GENL_ADMIN_PERM,
612 }, 612 },
613 { 613 {
614 .cmd = WL12XX_NL_CMD_INTERROGATE, 614 .cmd = WL1251_NL_CMD_INTERROGATE,
615 .doit = wl12xx_nl_interrogate, 615 .doit = wl1251_nl_interrogate,
616 .policy = wl12xx_nl_policy, 616 .policy = wl1251_nl_policy,
617 .flags = GENL_ADMIN_PERM, 617 .flags = GENL_ADMIN_PERM,
618 }, 618 },
619 { 619 {
620 .cmd = WL12XX_NL_CMD_CONFIGURE, 620 .cmd = WL1251_NL_CMD_CONFIGURE,
621 .doit = wl12xx_nl_configure, 621 .doit = wl1251_nl_configure,
622 .policy = wl12xx_nl_policy, 622 .policy = wl1251_nl_policy,
623 .flags = GENL_ADMIN_PERM, 623 .flags = GENL_ADMIN_PERM,
624 }, 624 },
625 { 625 {
626 .cmd = WL12XX_NL_CMD_PHY_REG_READ, 626 .cmd = WL1251_NL_CMD_PHY_REG_READ,
627 .doit = wl12xx_nl_phy_reg_read, 627 .doit = wl1251_nl_phy_reg_read,
628 .policy = wl12xx_nl_policy, 628 .policy = wl1251_nl_policy,
629 .flags = GENL_ADMIN_PERM, 629 .flags = GENL_ADMIN_PERM,
630 }, 630 },
631 { 631 {
632 .cmd = WL12XX_NL_CMD_NVS_PUSH, 632 .cmd = WL1251_NL_CMD_NVS_PUSH,
633 .doit = wl12xx_nl_nvs_push, 633 .doit = wl1251_nl_nvs_push,
634 .policy = wl12xx_nl_policy, 634 .policy = wl1251_nl_policy,
635 .flags = GENL_ADMIN_PERM, 635 .flags = GENL_ADMIN_PERM,
636 }, 636 },
637 { 637 {
638 .cmd = WL12XX_NL_CMD_REG_WRITE, 638 .cmd = WL1251_NL_CMD_REG_WRITE,
639 .doit = wl12xx_nl_reg_write, 639 .doit = wl1251_nl_reg_write,
640 .policy = wl12xx_nl_policy, 640 .policy = wl1251_nl_policy,
641 .flags = GENL_ADMIN_PERM, 641 .flags = GENL_ADMIN_PERM,
642 }, 642 },
643 { 643 {
644 .cmd = WL12XX_NL_CMD_REG_READ, 644 .cmd = WL1251_NL_CMD_REG_READ,
645 .doit = wl12xx_nl_reg_read, 645 .doit = wl1251_nl_reg_read,
646 .policy = wl12xx_nl_policy, 646 .policy = wl1251_nl_policy,
647 .flags = GENL_ADMIN_PERM, 647 .flags = GENL_ADMIN_PERM,
648 }, 648 },
649 { 649 {
650 .cmd = WL12XX_NL_CMD_SET_PLT_MODE, 650 .cmd = WL1251_NL_CMD_SET_PLT_MODE,
651 .doit = wl12xx_nl_set_plt_mode, 651 .doit = wl1251_nl_set_plt_mode,
652 .policy = wl12xx_nl_policy, 652 .policy = wl1251_nl_policy,
653 .flags = GENL_ADMIN_PERM, 653 .flags = GENL_ADMIN_PERM,
654 }, 654 },
655}; 655};
656 656
657int wl12xx_nl_register(void) 657int wl1251_nl_register(void)
658{ 658{
659 int err, i; 659 int err, i;
660 660
661 err = genl_register_family(&wl12xx_nl_family); 661 err = genl_register_family(&wl1251_nl_family);
662 if (err) 662 if (err)
663 return err; 663 return err;
664 664
665 for (i = 0; i < ARRAY_SIZE(wl12xx_nl_ops); i++) { 665 for (i = 0; i < ARRAY_SIZE(wl1251_nl_ops); i++) {
666 err = genl_register_ops(&wl12xx_nl_family, &wl12xx_nl_ops[i]); 666 err = genl_register_ops(&wl1251_nl_family, &wl1251_nl_ops[i]);
667 if (err) 667 if (err)
668 goto err_out; 668 goto err_out;
669 } 669 }
670 return 0; 670 return 0;
671 err_out: 671 err_out:
672 genl_unregister_family(&wl12xx_nl_family); 672 genl_unregister_family(&wl1251_nl_family);
673 return err; 673 return err;
674} 674}
675 675
676void wl12xx_nl_unregister(void) 676void wl1251_nl_unregister(void)
677{ 677{
678 genl_unregister_family(&wl12xx_nl_family); 678 genl_unregister_family(&wl1251_nl_family);
679} 679}
diff --git a/drivers/net/wireless/wl12xx/wl1251_netlink.h b/drivers/net/wireless/wl12xx/wl1251_netlink.h
index acfbd0241b8..ee36695e134 100644
--- a/drivers/net/wireless/wl12xx/wl1251_netlink.h
+++ b/drivers/net/wireless/wl12xx/wl1251_netlink.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (C) 2009 Nokia Corporation 4 * Copyright (C) 2009 Nokia Corporation
5 * 5 *
@@ -21,10 +21,10 @@
21 * 21 *
22 */ 22 */
23 23
24#ifndef __WL12XX_NETLINK_H__ 24#ifndef __WL1251_NETLINK_H__
25#define __WL12XX_NETLINK_H__ 25#define __WL1251_NETLINK_H__
26 26
27int wl12xx_nl_register(void); 27int wl1251_nl_register(void);
28void wl12xx_nl_unregister(void); 28void wl1251_nl_unregister(void);
29 29
30#endif /* __WL12XX_NETLINK_H__ */ 30#endif /* __WL1251_NETLINK_H__ */
diff --git a/drivers/net/wireless/wl12xx/wl1251_ops.c b/drivers/net/wireless/wl12xx/wl1251_ops.c
index cdfd2c21899..96a45f59529 100644
--- a/drivers/net/wireless/wl12xx/wl1251_ops.c
+++ b/drivers/net/wireless/wl12xx/wl1251_ops.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (C) 2008-2009 Nokia Corporation 4 * Copyright (C) 2008-2009 Nokia Corporation
5 * 5 *
@@ -35,7 +35,7 @@
35#include "wl1251_ps.h" 35#include "wl1251_ps.h"
36#include "wl1251_init.h" 36#include "wl1251_init.h"
37 37
38static struct wl12xx_partition_set wl1251_part_table[PART_TABLE_LEN] = { 38static struct wl1251_partition_set wl1251_part_table[PART_TABLE_LEN] = {
39 [PART_DOWN] = { 39 [PART_DOWN] = {
40 .mem = { 40 .mem = {
41 .start = 0x00000000, 41 .start = 0x00000000,
@@ -75,31 +75,31 @@ static enum wl12xx_acx_int_reg wl1251_acx_reg_table[ACX_REG_TABLE_LEN] = {
75 [ACX_REG_ECPU_CONTROL] = (REGISTERS_BASE + 0x0804) 75 [ACX_REG_ECPU_CONTROL] = (REGISTERS_BASE + 0x0804)
76}; 76};
77 77
78static int wl1251_upload_firmware(struct wl12xx *wl) 78static int wl1251_upload_firmware(struct wl1251 *wl)
79{ 79{
80 struct wl12xx_partition_set *p_table = wl->chip.p_table; 80 struct wl1251_partition_set *p_table = wl->chip.p_table;
81 int addr, chunk_num, partition_limit; 81 int addr, chunk_num, partition_limit;
82 size_t fw_data_len; 82 size_t fw_data_len;
83 u8 *p; 83 u8 *p;
84 84
85 /* whal_FwCtrl_LoadFwImageSm() */ 85 /* whal_FwCtrl_LoadFwImageSm() */
86 86
87 wl12xx_debug(DEBUG_BOOT, "chip id before fw upload: 0x%x", 87 wl1251_debug(DEBUG_BOOT, "chip id before fw upload: 0x%x",
88 wl12xx_reg_read32(wl, CHIP_ID_B)); 88 wl1251_reg_read32(wl, CHIP_ID_B));
89 89
90 /* 10.0 check firmware length and set partition */ 90 /* 10.0 check firmware length and set partition */
91 fw_data_len = (wl->fw[4] << 24) | (wl->fw[5] << 16) | 91 fw_data_len = (wl->fw[4] << 24) | (wl->fw[5] << 16) |
92 (wl->fw[6] << 8) | (wl->fw[7]); 92 (wl->fw[6] << 8) | (wl->fw[7]);
93 93
94 wl12xx_debug(DEBUG_BOOT, "fw_data_len %zu chunk_size %d", fw_data_len, 94 wl1251_debug(DEBUG_BOOT, "fw_data_len %zu chunk_size %d", fw_data_len,
95 CHUNK_SIZE); 95 CHUNK_SIZE);
96 96
97 if ((fw_data_len % 4) != 0) { 97 if ((fw_data_len % 4) != 0) {
98 wl12xx_error("firmware length not multiple of four"); 98 wl1251_error("firmware length not multiple of four");
99 return -EIO; 99 return -EIO;
100 } 100 }
101 101
102 wl12xx_set_partition(wl, 102 wl1251_set_partition(wl,
103 p_table[PART_DOWN].mem.start, 103 p_table[PART_DOWN].mem.start,
104 p_table[PART_DOWN].mem.size, 104 p_table[PART_DOWN].mem.size,
105 p_table[PART_DOWN].reg.start, 105 p_table[PART_DOWN].reg.start,
@@ -118,7 +118,7 @@ static int wl1251_upload_firmware(struct wl12xx *wl)
118 chunk_num * CHUNK_SIZE; 118 chunk_num * CHUNK_SIZE;
119 partition_limit = chunk_num * CHUNK_SIZE + 119 partition_limit = chunk_num * CHUNK_SIZE +
120 p_table[PART_DOWN].mem.size; 120 p_table[PART_DOWN].mem.size;
121 wl12xx_set_partition(wl, 121 wl1251_set_partition(wl,
122 addr, 122 addr,
123 p_table[PART_DOWN].mem.size, 123 p_table[PART_DOWN].mem.size,
124 p_table[PART_DOWN].reg.start, 124 p_table[PART_DOWN].reg.start,
@@ -128,9 +128,9 @@ static int wl1251_upload_firmware(struct wl12xx *wl)
128 /* 10.3 upload the chunk */ 128 /* 10.3 upload the chunk */
129 addr = p_table[PART_DOWN].mem.start + chunk_num * CHUNK_SIZE; 129 addr = p_table[PART_DOWN].mem.start + chunk_num * CHUNK_SIZE;
130 p = wl->fw + FW_HDR_SIZE + chunk_num * CHUNK_SIZE; 130 p = wl->fw + FW_HDR_SIZE + chunk_num * CHUNK_SIZE;
131 wl12xx_debug(DEBUG_BOOT, "uploading fw chunk 0x%p to 0x%x", 131 wl1251_debug(DEBUG_BOOT, "uploading fw chunk 0x%p to 0x%x",
132 p, addr); 132 p, addr);
133 wl12xx_spi_mem_write(wl, addr, p, CHUNK_SIZE); 133 wl1251_spi_mem_write(wl, addr, p, CHUNK_SIZE);
134 134
135 chunk_num++; 135 chunk_num++;
136 } 136 }
@@ -138,14 +138,14 @@ static int wl1251_upload_firmware(struct wl12xx *wl)
138 /* 10.4 upload the last chunk */ 138 /* 10.4 upload the last chunk */
139 addr = p_table[PART_DOWN].mem.start + chunk_num * CHUNK_SIZE; 139 addr = p_table[PART_DOWN].mem.start + chunk_num * CHUNK_SIZE;
140 p = wl->fw + FW_HDR_SIZE + chunk_num * CHUNK_SIZE; 140 p = wl->fw + FW_HDR_SIZE + chunk_num * CHUNK_SIZE;
141 wl12xx_debug(DEBUG_BOOT, "uploading fw last chunk (%zu B) 0x%p to 0x%x", 141 wl1251_debug(DEBUG_BOOT, "uploading fw last chunk (%zu B) 0x%p to 0x%x",
142 fw_data_len % CHUNK_SIZE, p, addr); 142 fw_data_len % CHUNK_SIZE, p, addr);
143 wl12xx_spi_mem_write(wl, addr, p, fw_data_len % CHUNK_SIZE); 143 wl1251_spi_mem_write(wl, addr, p, fw_data_len % CHUNK_SIZE);
144 144
145 return 0; 145 return 0;
146} 146}
147 147
148static int wl1251_upload_nvs(struct wl12xx *wl) 148static int wl1251_upload_nvs(struct wl1251 *wl)
149{ 149{
150 size_t nvs_len, nvs_bytes_written, burst_len; 150 size_t nvs_len, nvs_bytes_written, burst_len;
151 int nvs_start, i; 151 int nvs_start, i;
@@ -181,10 +181,10 @@ static int wl1251_upload_nvs(struct wl12xx *wl)
181 val = (nvs_ptr[0] | (nvs_ptr[1] << 8) 181 val = (nvs_ptr[0] | (nvs_ptr[1] << 8)
182 | (nvs_ptr[2] << 16) | (nvs_ptr[3] << 24)); 182 | (nvs_ptr[2] << 16) | (nvs_ptr[3] << 24));
183 183
184 wl12xx_debug(DEBUG_BOOT, 184 wl1251_debug(DEBUG_BOOT,
185 "nvs burst write 0x%x: 0x%x", 185 "nvs burst write 0x%x: 0x%x",
186 dest_addr, val); 186 dest_addr, val);
187 wl12xx_mem_write32(wl, dest_addr, val); 187 wl1251_mem_write32(wl, dest_addr, val);
188 188
189 nvs_ptr += 4; 189 nvs_ptr += 4;
190 dest_addr += 4; 190 dest_addr += 4;
@@ -200,7 +200,7 @@ static int wl1251_upload_nvs(struct wl12xx *wl)
200 nvs_len = ALIGN(nvs_len, 4); 200 nvs_len = ALIGN(nvs_len, 4);
201 201
202 /* Now we must set the partition correctly */ 202 /* Now we must set the partition correctly */
203 wl12xx_set_partition(wl, nvs_start, 203 wl1251_set_partition(wl, nvs_start,
204 wl->chip.p_table[PART_DOWN].mem.size, 204 wl->chip.p_table[PART_DOWN].mem.size,
205 wl->chip.p_table[PART_DOWN].reg.start, 205 wl->chip.p_table[PART_DOWN].reg.start,
206 wl->chip.p_table[PART_DOWN].reg.size); 206 wl->chip.p_table[PART_DOWN].reg.size);
@@ -213,10 +213,10 @@ static int wl1251_upload_nvs(struct wl12xx *wl)
213 213
214 val = cpu_to_le32(val); 214 val = cpu_to_le32(val);
215 215
216 wl12xx_debug(DEBUG_BOOT, 216 wl1251_debug(DEBUG_BOOT,
217 "nvs write table 0x%x: 0x%x", 217 "nvs write table 0x%x: 0x%x",
218 nvs_start, val); 218 nvs_start, val);
219 wl12xx_mem_write32(wl, nvs_start, val); 219 wl1251_mem_write32(wl, nvs_start, val);
220 220
221 nvs_ptr += 4; 221 nvs_ptr += 4;
222 nvs_bytes_written += 4; 222 nvs_bytes_written += 4;
@@ -226,12 +226,12 @@ static int wl1251_upload_nvs(struct wl12xx *wl)
226 return 0; 226 return 0;
227} 227}
228 228
229static int wl1251_boot(struct wl12xx *wl) 229static int wl1251_boot(struct wl1251 *wl)
230{ 230{
231 int ret = 0, minor_minor_e2_ver; 231 int ret = 0, minor_minor_e2_ver;
232 u32 tmp, boot_data; 232 u32 tmp, boot_data;
233 233
234 ret = wl12xx_boot_soft_reset(wl); 234 ret = wl1251_boot_soft_reset(wl);
235 if (ret < 0) 235 if (ret < 0)
236 goto out; 236 goto out;
237 237
@@ -242,39 +242,39 @@ static int wl1251_boot(struct wl12xx *wl)
242 242
243 /* write firmware's last address (ie. it's length) to 243 /* write firmware's last address (ie. it's length) to
244 * ACX_EEPROMLESS_IND_REG */ 244 * ACX_EEPROMLESS_IND_REG */
245 wl12xx_reg_write32(wl, ACX_EEPROMLESS_IND_REG, wl->fw_len); 245 wl1251_reg_write32(wl, ACX_EEPROMLESS_IND_REG, wl->fw_len);
246 246
247 /* 6. read the EEPROM parameters */ 247 /* 6. read the EEPROM parameters */
248 tmp = wl12xx_reg_read32(wl, SCR_PAD2); 248 tmp = wl1251_reg_read32(wl, SCR_PAD2);
249 249
250 /* 7. read bootdata */ 250 /* 7. read bootdata */
251 wl->boot_attr.radio_type = (tmp & 0x0000FF00) >> 8; 251 wl->boot_attr.radio_type = (tmp & 0x0000FF00) >> 8;
252 wl->boot_attr.major = (tmp & 0x00FF0000) >> 16; 252 wl->boot_attr.major = (tmp & 0x00FF0000) >> 16;
253 tmp = wl12xx_reg_read32(wl, SCR_PAD3); 253 tmp = wl1251_reg_read32(wl, SCR_PAD3);
254 254
255 /* 8. check bootdata and call restart sequence */ 255 /* 8. check bootdata and call restart sequence */
256 wl->boot_attr.minor = (tmp & 0x00FF0000) >> 16; 256 wl->boot_attr.minor = (tmp & 0x00FF0000) >> 16;
257 minor_minor_e2_ver = (tmp & 0xFF000000) >> 24; 257 minor_minor_e2_ver = (tmp & 0xFF000000) >> 24;
258 258
259 wl12xx_debug(DEBUG_BOOT, "radioType 0x%x majorE2Ver 0x%x " 259 wl1251_debug(DEBUG_BOOT, "radioType 0x%x majorE2Ver 0x%x "
260 "minorE2Ver 0x%x minor_minor_e2_ver 0x%x", 260 "minorE2Ver 0x%x minor_minor_e2_ver 0x%x",
261 wl->boot_attr.radio_type, wl->boot_attr.major, 261 wl->boot_attr.radio_type, wl->boot_attr.major,
262 wl->boot_attr.minor, minor_minor_e2_ver); 262 wl->boot_attr.minor, minor_minor_e2_ver);
263 263
264 ret = wl12xx_boot_init_seq(wl); 264 ret = wl1251_boot_init_seq(wl);
265 if (ret < 0) 265 if (ret < 0)
266 goto out; 266 goto out;
267 267
268 /* 9. NVS processing done */ 268 /* 9. NVS processing done */
269 boot_data = wl12xx_reg_read32(wl, ACX_REG_ECPU_CONTROL); 269 boot_data = wl1251_reg_read32(wl, ACX_REG_ECPU_CONTROL);
270 270
271 wl12xx_debug(DEBUG_BOOT, "halt boot_data 0x%x", boot_data); 271 wl1251_debug(DEBUG_BOOT, "halt boot_data 0x%x", boot_data);
272 272
273 /* 10. check that ECPU_CONTROL_HALT bits are set in 273 /* 10. check that ECPU_CONTROL_HALT bits are set in
274 * pWhalBus->uBootData and start uploading firmware 274 * pWhalBus->uBootData and start uploading firmware
275 */ 275 */
276 if ((boot_data & ECPU_CONTROL_HALT) == 0) { 276 if ((boot_data & ECPU_CONTROL_HALT) == 0) {
277 wl12xx_error("boot failed, ECPU_CONTROL_HALT not set"); 277 wl1251_error("boot failed, ECPU_CONTROL_HALT not set");
278 ret = -EIO; 278 ret = -EIO;
279 goto out; 279 goto out;
280 } 280 }
@@ -284,7 +284,7 @@ static int wl1251_boot(struct wl12xx *wl)
284 goto out; 284 goto out;
285 285
286 /* 10.5 start firmware */ 286 /* 10.5 start firmware */
287 ret = wl12xx_boot_run_firmware(wl); 287 ret = wl1251_boot_run_firmware(wl);
288 if (ret < 0) 288 if (ret < 0)
289 goto out; 289 goto out;
290 290
@@ -292,12 +292,12 @@ out:
292 return ret; 292 return ret;
293} 293}
294 294
295static int wl1251_mem_cfg(struct wl12xx *wl) 295static int wl1251_mem_cfg(struct wl1251 *wl)
296{ 296{
297 struct wl1251_acx_config_memory *mem_conf; 297 struct wl1251_acx_config_memory *mem_conf;
298 int ret, i; 298 int ret, i;
299 299
300 wl12xx_debug(DEBUG_ACX, "wl1251 mem cfg"); 300 wl1251_debug(DEBUG_ACX, "wl1251 mem cfg");
301 301
302 mem_conf = kzalloc(sizeof(*mem_conf), GFP_KERNEL); 302 mem_conf = kzalloc(sizeof(*mem_conf), GFP_KERNEL);
303 if (!mem_conf) { 303 if (!mem_conf) {
@@ -327,10 +327,10 @@ static int wl1251_mem_cfg(struct wl12xx *wl)
327 mem_conf->tx_queue_config[i].attributes = i; 327 mem_conf->tx_queue_config[i].attributes = i;
328 } 328 }
329 329
330 ret = wl12xx_cmd_configure(wl, ACX_MEM_CFG, mem_conf, 330 ret = wl1251_cmd_configure(wl, ACX_MEM_CFG, mem_conf,
331 sizeof(*mem_conf)); 331 sizeof(*mem_conf));
332 if (ret < 0) { 332 if (ret < 0) {
333 wl12xx_warning("wl1251 mem config failed: %d", ret); 333 wl1251_warning("wl1251 mem config failed: %d", ret);
334 goto out; 334 goto out;
335 } 335 }
336 336
@@ -339,7 +339,7 @@ out:
339 return ret; 339 return ret;
340} 340}
341 341
342static int wl1251_hw_init_mem_config(struct wl12xx *wl) 342static int wl1251_hw_init_mem_config(struct wl1251 *wl)
343{ 343{
344 int ret; 344 int ret;
345 345
@@ -350,15 +350,15 @@ static int wl1251_hw_init_mem_config(struct wl12xx *wl)
350 wl->target_mem_map = kzalloc(sizeof(struct wl1251_acx_mem_map), 350 wl->target_mem_map = kzalloc(sizeof(struct wl1251_acx_mem_map),
351 GFP_KERNEL); 351 GFP_KERNEL);
352 if (!wl->target_mem_map) { 352 if (!wl->target_mem_map) {
353 wl12xx_error("couldn't allocate target memory map"); 353 wl1251_error("couldn't allocate target memory map");
354 return -ENOMEM; 354 return -ENOMEM;
355 } 355 }
356 356
357 /* we now ask for the firmware built memory map */ 357 /* we now ask for the firmware built memory map */
358 ret = wl12xx_acx_mem_map(wl, wl->target_mem_map, 358 ret = wl1251_acx_mem_map(wl, wl->target_mem_map,
359 sizeof(struct wl1251_acx_mem_map)); 359 sizeof(struct wl1251_acx_mem_map));
360 if (ret < 0) { 360 if (ret < 0) {
361 wl12xx_error("couldn't retrieve firmware memory map"); 361 wl1251_error("couldn't retrieve firmware memory map");
362 kfree(wl->target_mem_map); 362 kfree(wl->target_mem_map);
363 wl->target_mem_map = NULL; 363 wl->target_mem_map = NULL;
364 return ret; 364 return ret;
@@ -367,19 +367,19 @@ static int wl1251_hw_init_mem_config(struct wl12xx *wl)
367 return 0; 367 return 0;
368} 368}
369 369
370static void wl1251_set_ecpu_ctrl(struct wl12xx *wl, u32 flag) 370static void wl1251_set_ecpu_ctrl(struct wl1251 *wl, u32 flag)
371{ 371{
372 u32 cpu_ctrl; 372 u32 cpu_ctrl;
373 373
374 /* 10.5.0 run the firmware (I) */ 374 /* 10.5.0 run the firmware (I) */
375 cpu_ctrl = wl12xx_reg_read32(wl, ACX_REG_ECPU_CONTROL); 375 cpu_ctrl = wl1251_reg_read32(wl, ACX_REG_ECPU_CONTROL);
376 376
377 /* 10.5.1 run the firmware (II) */ 377 /* 10.5.1 run the firmware (II) */
378 cpu_ctrl &= ~flag; 378 cpu_ctrl &= ~flag;
379 wl12xx_reg_write32(wl, ACX_REG_ECPU_CONTROL, cpu_ctrl); 379 wl1251_reg_write32(wl, ACX_REG_ECPU_CONTROL, cpu_ctrl);
380} 380}
381 381
382static void wl1251_target_enable_interrupts(struct wl12xx *wl) 382static void wl1251_target_enable_interrupts(struct wl1251 *wl)
383{ 383{
384 /* Enable target's interrupts */ 384 /* Enable target's interrupts */
385 wl->intr_mask = WL1251_ACX_INTR_RX0_DATA | 385 wl->intr_mask = WL1251_ACX_INTR_RX0_DATA |
@@ -388,60 +388,60 @@ static void wl1251_target_enable_interrupts(struct wl12xx *wl)
388 WL1251_ACX_INTR_EVENT_A | 388 WL1251_ACX_INTR_EVENT_A |
389 WL1251_ACX_INTR_EVENT_B | 389 WL1251_ACX_INTR_EVENT_B |
390 WL1251_ACX_INTR_INIT_COMPLETE; 390 WL1251_ACX_INTR_INIT_COMPLETE;
391 wl12xx_boot_target_enable_interrupts(wl); 391 wl1251_boot_target_enable_interrupts(wl);
392} 392}
393 393
394static void wl1251_fw_version(struct wl12xx *wl) 394static void wl1251_fw_version(struct wl1251 *wl)
395{ 395{
396 wl12xx_acx_fw_version(wl, wl->chip.fw_ver, sizeof(wl->chip.fw_ver)); 396 wl1251_acx_fw_version(wl, wl->chip.fw_ver, sizeof(wl->chip.fw_ver));
397} 397}
398 398
399static void wl1251_irq_work(struct work_struct *work) 399static void wl1251_irq_work(struct work_struct *work)
400{ 400{
401 u32 intr; 401 u32 intr;
402 struct wl12xx *wl = 402 struct wl1251 *wl =
403 container_of(work, struct wl12xx, irq_work); 403 container_of(work, struct wl1251, irq_work);
404 int ret; 404 int ret;
405 405
406 mutex_lock(&wl->mutex); 406 mutex_lock(&wl->mutex);
407 407
408 wl12xx_debug(DEBUG_IRQ, "IRQ work"); 408 wl1251_debug(DEBUG_IRQ, "IRQ work");
409 409
410 if (wl->state == WL12XX_STATE_OFF) 410 if (wl->state == WL1251_STATE_OFF)
411 goto out; 411 goto out;
412 412
413 ret = wl12xx_ps_elp_wakeup(wl); 413 ret = wl1251_ps_elp_wakeup(wl);
414 if (ret < 0) 414 if (ret < 0)
415 goto out; 415 goto out;
416 416
417 wl12xx_reg_write32(wl, ACX_REG_INTERRUPT_MASK, WL1251_ACX_INTR_ALL); 417 wl1251_reg_write32(wl, ACX_REG_INTERRUPT_MASK, WL1251_ACX_INTR_ALL);
418 418
419 intr = wl12xx_reg_read32(wl, ACX_REG_INTERRUPT_CLEAR); 419 intr = wl1251_reg_read32(wl, ACX_REG_INTERRUPT_CLEAR);
420 wl12xx_debug(DEBUG_IRQ, "intr: 0x%x", intr); 420 wl1251_debug(DEBUG_IRQ, "intr: 0x%x", intr);
421 421
422 if (wl->data_path) { 422 if (wl->data_path) {
423 wl->rx_counter = 423 wl->rx_counter =
424 wl12xx_mem_read32(wl, wl->data_path->rx_control_addr); 424 wl1251_mem_read32(wl, wl->data_path->rx_control_addr);
425 425
426 /* We handle a frmware bug here */ 426 /* We handle a frmware bug here */
427 switch ((wl->rx_counter - wl->rx_handled) & 0xf) { 427 switch ((wl->rx_counter - wl->rx_handled) & 0xf) {
428 case 0: 428 case 0:
429 wl12xx_debug(DEBUG_IRQ, "RX: FW and host in sync"); 429 wl1251_debug(DEBUG_IRQ, "RX: FW and host in sync");
430 intr &= ~WL1251_ACX_INTR_RX0_DATA; 430 intr &= ~WL1251_ACX_INTR_RX0_DATA;
431 intr &= ~WL1251_ACX_INTR_RX1_DATA; 431 intr &= ~WL1251_ACX_INTR_RX1_DATA;
432 break; 432 break;
433 case 1: 433 case 1:
434 wl12xx_debug(DEBUG_IRQ, "RX: FW +1"); 434 wl1251_debug(DEBUG_IRQ, "RX: FW +1");
435 intr |= WL1251_ACX_INTR_RX0_DATA; 435 intr |= WL1251_ACX_INTR_RX0_DATA;
436 intr &= ~WL1251_ACX_INTR_RX1_DATA; 436 intr &= ~WL1251_ACX_INTR_RX1_DATA;
437 break; 437 break;
438 case 2: 438 case 2:
439 wl12xx_debug(DEBUG_IRQ, "RX: FW +2"); 439 wl1251_debug(DEBUG_IRQ, "RX: FW +2");
440 intr |= WL1251_ACX_INTR_RX0_DATA; 440 intr |= WL1251_ACX_INTR_RX0_DATA;
441 intr |= WL1251_ACX_INTR_RX1_DATA; 441 intr |= WL1251_ACX_INTR_RX1_DATA;
442 break; 442 break;
443 default: 443 default:
444 wl12xx_warning("RX: FW and host out of sync: %d", 444 wl1251_warning("RX: FW and host out of sync: %d",
445 wl->rx_counter - wl->rx_handled); 445 wl->rx_counter - wl->rx_handled);
446 break; 446 break;
447 } 447 }
@@ -449,49 +449,49 @@ static void wl1251_irq_work(struct work_struct *work)
449 wl->rx_handled = wl->rx_counter; 449 wl->rx_handled = wl->rx_counter;
450 450
451 451
452 wl12xx_debug(DEBUG_IRQ, "RX counter: %d", wl->rx_counter); 452 wl1251_debug(DEBUG_IRQ, "RX counter: %d", wl->rx_counter);
453 } 453 }
454 454
455 intr &= wl->intr_mask; 455 intr &= wl->intr_mask;
456 456
457 if (intr == 0) { 457 if (intr == 0) {
458 wl12xx_debug(DEBUG_IRQ, "INTR is 0"); 458 wl1251_debug(DEBUG_IRQ, "INTR is 0");
459 wl12xx_reg_write32(wl, ACX_REG_INTERRUPT_MASK, 459 wl1251_reg_write32(wl, ACX_REG_INTERRUPT_MASK,
460 ~(wl->intr_mask)); 460 ~(wl->intr_mask));
461 461
462 goto out_sleep; 462 goto out_sleep;
463 } 463 }
464 464
465 if (intr & WL1251_ACX_INTR_RX0_DATA) { 465 if (intr & WL1251_ACX_INTR_RX0_DATA) {
466 wl12xx_debug(DEBUG_IRQ, "WL1251_ACX_INTR_RX0_DATA"); 466 wl1251_debug(DEBUG_IRQ, "WL1251_ACX_INTR_RX0_DATA");
467 wl12xx_rx(wl); 467 wl1251_rx(wl);
468 } 468 }
469 469
470 if (intr & WL1251_ACX_INTR_RX1_DATA) { 470 if (intr & WL1251_ACX_INTR_RX1_DATA) {
471 wl12xx_debug(DEBUG_IRQ, "WL1251_ACX_INTR_RX1_DATA"); 471 wl1251_debug(DEBUG_IRQ, "WL1251_ACX_INTR_RX1_DATA");
472 wl12xx_rx(wl); 472 wl1251_rx(wl);
473 } 473 }
474 474
475 if (intr & WL1251_ACX_INTR_TX_RESULT) { 475 if (intr & WL1251_ACX_INTR_TX_RESULT) {
476 wl12xx_debug(DEBUG_IRQ, "WL1251_ACX_INTR_TX_RESULT"); 476 wl1251_debug(DEBUG_IRQ, "WL1251_ACX_INTR_TX_RESULT");
477 wl1251_tx_complete(wl); 477 wl1251_tx_complete(wl);
478 } 478 }
479 479
480 if (intr & (WL1251_ACX_INTR_EVENT_A | WL1251_ACX_INTR_EVENT_B)) { 480 if (intr & (WL1251_ACX_INTR_EVENT_A | WL1251_ACX_INTR_EVENT_B)) {
481 wl12xx_debug(DEBUG_IRQ, "WL1251_ACX_INTR_EVENT (0x%x)", intr); 481 wl1251_debug(DEBUG_IRQ, "WL1251_ACX_INTR_EVENT (0x%x)", intr);
482 if (intr & WL1251_ACX_INTR_EVENT_A) 482 if (intr & WL1251_ACX_INTR_EVENT_A)
483 wl12xx_event_handle(wl, 0); 483 wl1251_event_handle(wl, 0);
484 else 484 else
485 wl12xx_event_handle(wl, 1); 485 wl1251_event_handle(wl, 1);
486 } 486 }
487 487
488 if (intr & WL1251_ACX_INTR_INIT_COMPLETE) 488 if (intr & WL1251_ACX_INTR_INIT_COMPLETE)
489 wl12xx_debug(DEBUG_IRQ, "WL1251_ACX_INTR_INIT_COMPLETE"); 489 wl1251_debug(DEBUG_IRQ, "WL1251_ACX_INTR_INIT_COMPLETE");
490 490
491 wl12xx_reg_write32(wl, ACX_REG_INTERRUPT_MASK, ~(wl->intr_mask)); 491 wl1251_reg_write32(wl, ACX_REG_INTERRUPT_MASK, ~(wl->intr_mask));
492 492
493out_sleep: 493out_sleep:
494 wl12xx_ps_elp_sleep(wl); 494 wl1251_ps_elp_sleep(wl);
495 495
496out: 496out:
497 mutex_unlock(&wl->mutex); 497 mutex_unlock(&wl->mutex);
@@ -529,20 +529,20 @@ static int wl1251_hw_init_txq_fill(u8 qid,
529 (QOS_TX_LOW_VO_DEF * num_blocks) / 100; 529 (QOS_TX_LOW_VO_DEF * num_blocks) / 100;
530 break; 530 break;
531 default: 531 default:
532 wl12xx_error("Invalid TX queue id: %d", qid); 532 wl1251_error("Invalid TX queue id: %d", qid);
533 return -EINVAL; 533 return -EINVAL;
534 } 534 }
535 535
536 return 0; 536 return 0;
537} 537}
538 538
539static int wl1251_hw_init_tx_queue_config(struct wl12xx *wl) 539static int wl1251_hw_init_tx_queue_config(struct wl1251 *wl)
540{ 540{
541 struct acx_tx_queue_qos_config *config; 541 struct acx_tx_queue_qos_config *config;
542 struct wl1251_acx_mem_map *wl_mem_map = wl->target_mem_map; 542 struct wl1251_acx_mem_map *wl_mem_map = wl->target_mem_map;
543 int ret, i; 543 int ret, i;
544 544
545 wl12xx_debug(DEBUG_ACX, "acx tx queue config"); 545 wl1251_debug(DEBUG_ACX, "acx tx queue config");
546 546
547 config = kzalloc(sizeof(*config), GFP_KERNEL); 547 config = kzalloc(sizeof(*config), GFP_KERNEL);
548 if (!config) { 548 if (!config) {
@@ -556,7 +556,7 @@ static int wl1251_hw_init_tx_queue_config(struct wl12xx *wl)
556 if (ret < 0) 556 if (ret < 0)
557 goto out; 557 goto out;
558 558
559 ret = wl12xx_cmd_configure(wl, ACX_TX_QUEUE_CFG, 559 ret = wl1251_cmd_configure(wl, ACX_TX_QUEUE_CFG,
560 config, sizeof(*config)); 560 config, sizeof(*config));
561 if (ret < 0) 561 if (ret < 0)
562 goto out; 562 goto out;
@@ -567,7 +567,7 @@ out:
567 return ret; 567 return ret;
568} 568}
569 569
570static int wl1251_hw_init_data_path_config(struct wl12xx *wl) 570static int wl1251_hw_init_data_path_config(struct wl1251 *wl)
571{ 571{
572 int ret; 572 int ret;
573 573
@@ -575,11 +575,11 @@ static int wl1251_hw_init_data_path_config(struct wl12xx *wl)
575 wl->data_path = kzalloc(sizeof(struct acx_data_path_params_resp), 575 wl->data_path = kzalloc(sizeof(struct acx_data_path_params_resp),
576 GFP_KERNEL); 576 GFP_KERNEL);
577 if (!wl->data_path) { 577 if (!wl->data_path) {
578 wl12xx_error("Couldnt allocate data path parameters"); 578 wl1251_error("Couldnt allocate data path parameters");
579 return -ENOMEM; 579 return -ENOMEM;
580 } 580 }
581 581
582 ret = wl12xx_acx_data_path_params(wl, wl->data_path); 582 ret = wl1251_acx_data_path_params(wl, wl->data_path);
583 if (ret < 0) { 583 if (ret < 0) {
584 kfree(wl->data_path); 584 kfree(wl->data_path);
585 wl->data_path = NULL; 585 wl->data_path = NULL;
@@ -589,17 +589,17 @@ static int wl1251_hw_init_data_path_config(struct wl12xx *wl)
589 return 0; 589 return 0;
590} 590}
591 591
592static int wl1251_hw_init(struct wl12xx *wl) 592static int wl1251_hw_init(struct wl1251 *wl)
593{ 593{
594 struct wl1251_acx_mem_map *wl_mem_map; 594 struct wl1251_acx_mem_map *wl_mem_map;
595 int ret; 595 int ret;
596 596
597 ret = wl12xx_hw_init_hwenc_config(wl); 597 ret = wl1251_hw_init_hwenc_config(wl);
598 if (ret < 0) 598 if (ret < 0)
599 return ret; 599 return ret;
600 600
601 /* Template settings */ 601 /* Template settings */
602 ret = wl12xx_hw_init_templates_config(wl); 602 ret = wl1251_hw_init_templates_config(wl);
603 if (ret < 0) 603 if (ret < 0)
604 return ret; 604 return ret;
605 605
@@ -614,7 +614,7 @@ static int wl1251_hw_init(struct wl12xx *wl)
614 goto out_free_memmap; 614 goto out_free_memmap;
615 615
616 /* RX config */ 616 /* RX config */
617 ret = wl12xx_hw_init_rx_config(wl, 617 ret = wl1251_hw_init_rx_config(wl,
618 RX_CFG_PROMISCUOUS | RX_CFG_TSF, 618 RX_CFG_PROMISCUOUS | RX_CFG_TSF,
619 RX_FILTER_OPTION_DEF); 619 RX_FILTER_OPTION_DEF);
620 /* RX_CONFIG_OPTION_ANY_DST_ANY_BSS, 620 /* RX_CONFIG_OPTION_ANY_DST_ANY_BSS,
@@ -628,42 +628,42 @@ static int wl1251_hw_init(struct wl12xx *wl)
628 goto out_free_data_path; 628 goto out_free_data_path;
629 629
630 /* PHY layer config */ 630 /* PHY layer config */
631 ret = wl12xx_hw_init_phy_config(wl); 631 ret = wl1251_hw_init_phy_config(wl);
632 if (ret < 0) 632 if (ret < 0)
633 goto out_free_data_path; 633 goto out_free_data_path;
634 634
635 /* Beacon filtering */ 635 /* Beacon filtering */
636 ret = wl12xx_hw_init_beacon_filter(wl); 636 ret = wl1251_hw_init_beacon_filter(wl);
637 if (ret < 0) 637 if (ret < 0)
638 goto out_free_data_path; 638 goto out_free_data_path;
639 639
640 /* Bluetooth WLAN coexistence */ 640 /* Bluetooth WLAN coexistence */
641 ret = wl12xx_hw_init_pta(wl); 641 ret = wl1251_hw_init_pta(wl);
642 if (ret < 0) 642 if (ret < 0)
643 goto out_free_data_path; 643 goto out_free_data_path;
644 644
645 /* Energy detection */ 645 /* Energy detection */
646 ret = wl12xx_hw_init_energy_detection(wl); 646 ret = wl1251_hw_init_energy_detection(wl);
647 if (ret < 0) 647 if (ret < 0)
648 goto out_free_data_path; 648 goto out_free_data_path;
649 649
650 /* Beacons and boradcast settings */ 650 /* Beacons and boradcast settings */
651 ret = wl12xx_hw_init_beacon_broadcast(wl); 651 ret = wl1251_hw_init_beacon_broadcast(wl);
652 if (ret < 0) 652 if (ret < 0)
653 goto out_free_data_path; 653 goto out_free_data_path;
654 654
655 /* Enable data path */ 655 /* Enable data path */
656 ret = wl12xx_cmd_data_path(wl, wl->channel, 1); 656 ret = wl1251_cmd_data_path(wl, wl->channel, 1);
657 if (ret < 0) 657 if (ret < 0)
658 goto out_free_data_path; 658 goto out_free_data_path;
659 659
660 /* Default power state */ 660 /* Default power state */
661 ret = wl12xx_hw_init_power_auth(wl); 661 ret = wl1251_hw_init_power_auth(wl);
662 if (ret < 0) 662 if (ret < 0)
663 goto out_free_data_path; 663 goto out_free_data_path;
664 664
665 wl_mem_map = wl->target_mem_map; 665 wl_mem_map = wl->target_mem_map;
666 wl12xx_info("%d tx blocks at 0x%x, %d rx blocks at 0x%x", 666 wl1251_info("%d tx blocks at 0x%x, %d rx blocks at 0x%x",
667 wl_mem_map->num_tx_mem_blocks, 667 wl_mem_map->num_tx_mem_blocks,
668 wl->data_path->tx_control_addr, 668 wl->data_path->tx_control_addr,
669 wl_mem_map->num_rx_mem_blocks, 669 wl_mem_map->num_rx_mem_blocks,
@@ -680,7 +680,7 @@ static int wl1251_hw_init(struct wl12xx *wl)
680 return ret; 680 return ret;
681} 681}
682 682
683static int wl1251_plt_init(struct wl12xx *wl) 683static int wl1251_plt_init(struct wl1251 *wl)
684{ 684{
685 int ret; 685 int ret;
686 686
@@ -688,14 +688,14 @@ static int wl1251_plt_init(struct wl12xx *wl)
688 if (ret < 0) 688 if (ret < 0)
689 return ret; 689 return ret;
690 690
691 ret = wl12xx_cmd_data_path(wl, wl->channel, 1); 691 ret = wl1251_cmd_data_path(wl, wl->channel, 1);
692 if (ret < 0) 692 if (ret < 0)
693 return ret; 693 return ret;
694 694
695 return 0; 695 return 0;
696} 696}
697 697
698void wl1251_setup(struct wl12xx *wl) 698void wl1251_setup(struct wl1251 *wl)
699{ 699{
700 /* FIXME: Is it better to use strncpy here or is this ok? */ 700 /* FIXME: Is it better to use strncpy here or is this ok? */
701 wl->chip.fw_filename = WL1251_FW_NAME; 701 wl->chip.fw_filename = WL1251_FW_NAME;
diff --git a/drivers/net/wireless/wl12xx/wl1251_ops.h b/drivers/net/wireless/wl12xx/wl1251_ops.h
index c5c997bb64d..68183c472e4 100644
--- a/drivers/net/wireless/wl12xx/wl1251_ops.h
+++ b/drivers/net/wireless/wl12xx/wl1251_ops.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (C) 2008 Nokia Corporation 4 * Copyright (C) 2008 Nokia Corporation
5 * 5 *
@@ -34,7 +34,7 @@
34 34
35#define WL1251_POWER_ON_SLEEP 10 /* in miliseconds */ 35#define WL1251_POWER_ON_SLEEP 10 /* in miliseconds */
36 36
37void wl1251_setup(struct wl12xx *wl); 37void wl1251_setup(struct wl1251 *wl);
38 38
39 39
40struct wl1251_acx_memory { 40struct wl1251_acx_memory {
diff --git a/drivers/net/wireless/wl12xx/wl1251_ps.c b/drivers/net/wireless/wl12xx/wl1251_ps.c
index 83baaa2eb19..68ff7f1900e 100644
--- a/drivers/net/wireless/wl12xx/wl1251_ps.c
+++ b/drivers/net/wireless/wl12xx/wl1251_ps.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (C) 2008 Nokia Corporation 4 * Copyright (C) 2008 Nokia Corporation
5 * 5 *
@@ -25,22 +25,22 @@
25#include "wl1251_ps.h" 25#include "wl1251_ps.h"
26#include "wl1251_spi.h" 26#include "wl1251_spi.h"
27 27
28#define WL12XX_WAKEUP_TIMEOUT 2000 28#define WL1251_WAKEUP_TIMEOUT 2000
29 29
30/* Routines to toggle sleep mode while in ELP */ 30/* Routines to toggle sleep mode while in ELP */
31void wl12xx_ps_elp_sleep(struct wl12xx *wl) 31void wl1251_ps_elp_sleep(struct wl1251 *wl)
32{ 32{
33 if (wl->elp || !wl->psm) 33 if (wl->elp || !wl->psm)
34 return; 34 return;
35 35
36 wl12xx_debug(DEBUG_PSM, "chip to elp"); 36 wl1251_debug(DEBUG_PSM, "chip to elp");
37 37
38 wl12xx_write32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, ELPCTRL_SLEEP); 38 wl1251_write32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, ELPCTRL_SLEEP);
39 39
40 wl->elp = true; 40 wl->elp = true;
41} 41}
42 42
43int wl12xx_ps_elp_wakeup(struct wl12xx *wl) 43int wl1251_ps_elp_wakeup(struct wl1251 *wl)
44{ 44{
45 unsigned long timeout; 45 unsigned long timeout;
46 u32 elp_reg; 46 u32 elp_reg;
@@ -48,13 +48,13 @@ int wl12xx_ps_elp_wakeup(struct wl12xx *wl)
48 if (!wl->elp) 48 if (!wl->elp)
49 return 0; 49 return 0;
50 50
51 wl12xx_debug(DEBUG_PSM, "waking up chip from elp"); 51 wl1251_debug(DEBUG_PSM, "waking up chip from elp");
52 52
53 timeout = jiffies + msecs_to_jiffies(WL12XX_WAKEUP_TIMEOUT); 53 timeout = jiffies + msecs_to_jiffies(WL1251_WAKEUP_TIMEOUT);
54 54
55 wl12xx_write32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, ELPCTRL_WAKE_UP); 55 wl1251_write32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, ELPCTRL_WAKE_UP);
56 56
57 elp_reg = wl12xx_read32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR); 57 elp_reg = wl1251_read32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR);
58 58
59 /* 59 /*
60 * FIXME: we should wait for irq from chip but, as a temporary 60 * FIXME: we should wait for irq from chip but, as a temporary
@@ -62,36 +62,36 @@ int wl12xx_ps_elp_wakeup(struct wl12xx *wl)
62 */ 62 */
63 while (!(elp_reg & ELPCTRL_WLAN_READY)) { 63 while (!(elp_reg & ELPCTRL_WLAN_READY)) {
64 if (time_after(jiffies, timeout)) { 64 if (time_after(jiffies, timeout)) {
65 wl12xx_error("elp wakeup timeout"); 65 wl1251_error("elp wakeup timeout");
66 return -ETIMEDOUT; 66 return -ETIMEDOUT;
67 } 67 }
68 msleep(1); 68 msleep(1);
69 elp_reg = wl12xx_read32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR); 69 elp_reg = wl1251_read32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR);
70 } 70 }
71 71
72 wl12xx_debug(DEBUG_PSM, "wakeup time: %u ms", 72 wl1251_debug(DEBUG_PSM, "wakeup time: %u ms",
73 jiffies_to_msecs(jiffies) - 73 jiffies_to_msecs(jiffies) -
74 (jiffies_to_msecs(timeout) - WL12XX_WAKEUP_TIMEOUT)); 74 (jiffies_to_msecs(timeout) - WL1251_WAKEUP_TIMEOUT));
75 75
76 wl->elp = false; 76 wl->elp = false;
77 77
78 return 0; 78 return 0;
79} 79}
80 80
81static int wl12xx_ps_set_elp(struct wl12xx *wl, bool enable) 81static int wl1251_ps_set_elp(struct wl1251 *wl, bool enable)
82{ 82{
83 int ret; 83 int ret;
84 84
85 if (enable) { 85 if (enable) {
86 wl12xx_debug(DEBUG_PSM, "sleep auth psm/elp"); 86 wl1251_debug(DEBUG_PSM, "sleep auth psm/elp");
87 87
88 ret = wl12xx_acx_sleep_auth(wl, WL12XX_PSM_ELP); 88 ret = wl1251_acx_sleep_auth(wl, WL1251_PSM_ELP);
89 if (ret < 0) 89 if (ret < 0)
90 return ret; 90 return ret;
91 91
92 wl12xx_ps_elp_sleep(wl); 92 wl1251_ps_elp_sleep(wl);
93 } else { 93 } else {
94 wl12xx_debug(DEBUG_PSM, "sleep auth cam"); 94 wl1251_debug(DEBUG_PSM, "sleep auth cam");
95 95
96 /* 96 /*
97 * When the target is in ELP, we can only 97 * When the target is in ELP, we can only
@@ -100,9 +100,9 @@ static int wl12xx_ps_set_elp(struct wl12xx *wl, bool enable)
100 * changing the power authorization. 100 * changing the power authorization.
101 */ 101 */
102 102
103 wl12xx_ps_elp_wakeup(wl); 103 wl1251_ps_elp_wakeup(wl);
104 104
105 ret = wl12xx_acx_sleep_auth(wl, WL12XX_PSM_CAM); 105 ret = wl1251_acx_sleep_auth(wl, WL1251_PSM_CAM);
106 if (ret < 0) 106 if (ret < 0)
107 return ret; 107 return ret;
108 } 108 }
@@ -110,18 +110,18 @@ static int wl12xx_ps_set_elp(struct wl12xx *wl, bool enable)
110 return 0; 110 return 0;
111} 111}
112 112
113int wl12xx_ps_set_mode(struct wl12xx *wl, enum wl12xx_cmd_ps_mode mode) 113int wl1251_ps_set_mode(struct wl1251 *wl, enum wl1251_cmd_ps_mode mode)
114{ 114{
115 int ret; 115 int ret;
116 116
117 switch (mode) { 117 switch (mode) {
118 case STATION_POWER_SAVE_MODE: 118 case STATION_POWER_SAVE_MODE:
119 wl12xx_debug(DEBUG_PSM, "entering psm"); 119 wl1251_debug(DEBUG_PSM, "entering psm");
120 ret = wl12xx_cmd_ps_mode(wl, STATION_POWER_SAVE_MODE); 120 ret = wl1251_cmd_ps_mode(wl, STATION_POWER_SAVE_MODE);
121 if (ret < 0) 121 if (ret < 0)
122 return ret; 122 return ret;
123 123
124 ret = wl12xx_ps_set_elp(wl, true); 124 ret = wl1251_ps_set_elp(wl, true);
125 if (ret < 0) 125 if (ret < 0)
126 return ret; 126 return ret;
127 127
@@ -129,12 +129,12 @@ int wl12xx_ps_set_mode(struct wl12xx *wl, enum wl12xx_cmd_ps_mode mode)
129 break; 129 break;
130 case STATION_ACTIVE_MODE: 130 case STATION_ACTIVE_MODE:
131 default: 131 default:
132 wl12xx_debug(DEBUG_PSM, "leaving psm"); 132 wl1251_debug(DEBUG_PSM, "leaving psm");
133 ret = wl12xx_ps_set_elp(wl, false); 133 ret = wl1251_ps_set_elp(wl, false);
134 if (ret < 0) 134 if (ret < 0)
135 return ret; 135 return ret;
136 136
137 ret = wl12xx_cmd_ps_mode(wl, STATION_ACTIVE_MODE); 137 ret = wl1251_cmd_ps_mode(wl, STATION_ACTIVE_MODE);
138 if (ret < 0) 138 if (ret < 0)
139 return ret; 139 return ret;
140 140
diff --git a/drivers/net/wireless/wl12xx/wl1251_ps.h b/drivers/net/wireless/wl12xx/wl1251_ps.h
index 8877842baf1..db036fe12f2 100644
--- a/drivers/net/wireless/wl12xx/wl1251_ps.h
+++ b/drivers/net/wireless/wl12xx/wl1251_ps.h
@@ -1,8 +1,8 @@
1#ifndef __WL12XX_PS_H__ 1#ifndef __WL1251_PS_H__
2#define __WL12XX_PS_H__ 2#define __WL1251_PS_H__
3 3
4/* 4/*
5 * This file is part of wl12xx 5 * This file is part of wl1251
6 * 6 *
7 * Copyright (c) 1998-2007 Texas Instruments Incorporated 7 * Copyright (c) 1998-2007 Texas Instruments Incorporated
8 * Copyright (C) 2008 Nokia Corporation 8 * Copyright (C) 2008 Nokia Corporation
@@ -28,9 +28,9 @@
28#include "wl1251.h" 28#include "wl1251.h"
29#include "wl1251_acx.h" 29#include "wl1251_acx.h"
30 30
31int wl12xx_ps_set_mode(struct wl12xx *wl, enum wl12xx_cmd_ps_mode mode); 31int wl1251_ps_set_mode(struct wl1251 *wl, enum wl1251_cmd_ps_mode mode);
32void wl12xx_ps_elp_sleep(struct wl12xx *wl); 32void wl1251_ps_elp_sleep(struct wl1251 *wl);
33int wl12xx_ps_elp_wakeup(struct wl12xx *wl); 33int wl1251_ps_elp_wakeup(struct wl1251 *wl);
34 34
35 35
36#endif /* __WL12XX_PS_H__ */ 36#endif /* __WL1251_PS_H__ */
diff --git a/drivers/net/wireless/wl12xx/wl1251_rx.c b/drivers/net/wireless/wl12xx/wl1251_rx.c
index 280fc1843f8..48fa39ea17e 100644
--- a/drivers/net/wireless/wl12xx/wl1251_rx.c
+++ b/drivers/net/wireless/wl12xx/wl1251_rx.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (c) 1998-2007 Texas Instruments Incorporated 4 * Copyright (c) 1998-2007 Texas Instruments Incorporated
5 * Copyright (C) 2008 Nokia Corporation 5 * Copyright (C) 2008 Nokia Corporation
@@ -31,8 +31,8 @@
31#include "wl1251_rx.h" 31#include "wl1251_rx.h"
32#include "wl1251_acx.h" 32#include "wl1251_acx.h"
33 33
34static void wl12xx_rx_header(struct wl12xx *wl, 34static void wl1251_rx_header(struct wl1251 *wl,
35 struct wl12xx_rx_descriptor *desc) 35 struct wl1251_rx_descriptor *desc)
36{ 36{
37 u32 rx_packet_ring_addr; 37 u32 rx_packet_ring_addr;
38 38
@@ -40,11 +40,11 @@ static void wl12xx_rx_header(struct wl12xx *wl,
40 if (wl->rx_current_buffer) 40 if (wl->rx_current_buffer)
41 rx_packet_ring_addr += wl->data_path->rx_packet_ring_chunk_size; 41 rx_packet_ring_addr += wl->data_path->rx_packet_ring_chunk_size;
42 42
43 wl12xx_spi_mem_read(wl, rx_packet_ring_addr, desc, sizeof(*desc)); 43 wl1251_spi_mem_read(wl, rx_packet_ring_addr, desc, sizeof(*desc));
44} 44}
45 45
46static void wl12xx_rx_status(struct wl12xx *wl, 46static void wl1251_rx_status(struct wl1251 *wl,
47 struct wl12xx_rx_descriptor *desc, 47 struct wl1251_rx_descriptor *desc,
48 struct ieee80211_rx_status *status, 48 struct ieee80211_rx_status *status,
49 u8 beacon) 49 u8 beacon)
50{ 50{
@@ -65,14 +65,14 @@ static void wl12xx_rx_status(struct wl12xx *wl,
65 * this one must be atomic, while our SPI routines can sleep. 65 * this one must be atomic, while our SPI routines can sleep.
66 */ 66 */
67 if ((wl->bss_type == BSS_TYPE_IBSS) && beacon) { 67 if ((wl->bss_type == BSS_TYPE_IBSS) && beacon) {
68 ret = wl12xx_acx_tsf_info(wl, &mactime); 68 ret = wl1251_acx_tsf_info(wl, &mactime);
69 if (ret == 0) 69 if (ret == 0)
70 status->mactime = mactime; 70 status->mactime = mactime;
71 } 71 }
72 72
73 status->signal = desc->rssi; 73 status->signal = desc->rssi;
74 status->qual = (desc->rssi - WL12XX_RX_MIN_RSSI) * 100 / 74 status->qual = (desc->rssi - WL1251_RX_MIN_RSSI) * 100 /
75 (WL12XX_RX_MAX_RSSI - WL12XX_RX_MIN_RSSI); 75 (WL1251_RX_MAX_RSSI - WL1251_RX_MIN_RSSI);
76 status->qual = min(status->qual, 100); 76 status->qual = min(status->qual, 100);
77 status->qual = max(status->qual, 0); 77 status->qual = max(status->qual, 0);
78 78
@@ -103,8 +103,8 @@ static void wl12xx_rx_status(struct wl12xx *wl,
103 /* FIXME: set status->rate_idx */ 103 /* FIXME: set status->rate_idx */
104} 104}
105 105
106static void wl12xx_rx_body(struct wl12xx *wl, 106static void wl1251_rx_body(struct wl1251 *wl,
107 struct wl12xx_rx_descriptor *desc) 107 struct wl1251_rx_descriptor *desc)
108{ 108{
109 struct sk_buff *skb; 109 struct sk_buff *skb;
110 struct ieee80211_rx_status status; 110 struct ieee80211_rx_status status;
@@ -112,12 +112,12 @@ static void wl12xx_rx_body(struct wl12xx *wl,
112 u16 length, *fc; 112 u16 length, *fc;
113 u32 curr_id, last_id_inc, rx_packet_ring_addr; 113 u32 curr_id, last_id_inc, rx_packet_ring_addr;
114 114
115 length = WL12XX_RX_ALIGN(desc->length - PLCP_HEADER_LENGTH); 115 length = WL1251_RX_ALIGN(desc->length - PLCP_HEADER_LENGTH);
116 curr_id = (desc->flags & RX_DESC_SEQNUM_MASK) >> RX_DESC_PACKETID_SHIFT; 116 curr_id = (desc->flags & RX_DESC_SEQNUM_MASK) >> RX_DESC_PACKETID_SHIFT;
117 last_id_inc = (wl->rx_last_id + 1) % (RX_MAX_PACKET_ID + 1); 117 last_id_inc = (wl->rx_last_id + 1) % (RX_MAX_PACKET_ID + 1);
118 118
119 if (last_id_inc != curr_id) { 119 if (last_id_inc != curr_id) {
120 wl12xx_warning("curr ID:%d, last ID inc:%d", 120 wl1251_warning("curr ID:%d, last ID inc:%d",
121 curr_id, last_id_inc); 121 curr_id, last_id_inc);
122 wl->rx_last_id = curr_id; 122 wl->rx_last_id = curr_id;
123 } else { 123 } else {
@@ -125,18 +125,18 @@ static void wl12xx_rx_body(struct wl12xx *wl,
125 } 125 }
126 126
127 rx_packet_ring_addr = wl->data_path->rx_packet_ring_addr + 127 rx_packet_ring_addr = wl->data_path->rx_packet_ring_addr +
128 sizeof(struct wl12xx_rx_descriptor) + 20; 128 sizeof(struct wl1251_rx_descriptor) + 20;
129 if (wl->rx_current_buffer) 129 if (wl->rx_current_buffer)
130 rx_packet_ring_addr += wl->data_path->rx_packet_ring_chunk_size; 130 rx_packet_ring_addr += wl->data_path->rx_packet_ring_chunk_size;
131 131
132 skb = dev_alloc_skb(length); 132 skb = dev_alloc_skb(length);
133 if (!skb) { 133 if (!skb) {
134 wl12xx_error("Couldn't allocate RX frame"); 134 wl1251_error("Couldn't allocate RX frame");
135 return; 135 return;
136 } 136 }
137 137
138 rx_buffer = skb_put(skb, length); 138 rx_buffer = skb_put(skb, length);
139 wl12xx_spi_mem_read(wl, rx_packet_ring_addr, rx_buffer, length); 139 wl1251_spi_mem_read(wl, rx_packet_ring_addr, rx_buffer, length);
140 140
141 /* The actual lenght doesn't include the target's alignment */ 141 /* The actual lenght doesn't include the target's alignment */
142 skb->len = desc->length - PLCP_HEADER_LENGTH; 142 skb->len = desc->length - PLCP_HEADER_LENGTH;
@@ -146,15 +146,15 @@ static void wl12xx_rx_body(struct wl12xx *wl,
146 if ((*fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_BEACON) 146 if ((*fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_BEACON)
147 beacon = 1; 147 beacon = 1;
148 148
149 wl12xx_rx_status(wl, desc, &status, beacon); 149 wl1251_rx_status(wl, desc, &status, beacon);
150 150
151 wl12xx_debug(DEBUG_RX, "rx skb 0x%p: %d B %s", skb, skb->len, 151 wl1251_debug(DEBUG_RX, "rx skb 0x%p: %d B %s", skb, skb->len,
152 beacon ? "beacon" : ""); 152 beacon ? "beacon" : "");
153 153
154 ieee80211_rx(wl->hw, skb, &status); 154 ieee80211_rx(wl->hw, skb, &status);
155} 155}
156 156
157static void wl12xx_rx_ack(struct wl12xx *wl) 157static void wl1251_rx_ack(struct wl1251 *wl)
158{ 158{
159 u32 data, addr; 159 u32 data, addr;
160 160
@@ -166,30 +166,30 @@ static void wl12xx_rx_ack(struct wl12xx *wl)
166 data = INTR_TRIG_RX_PROC0; 166 data = INTR_TRIG_RX_PROC0;
167 } 167 }
168 168
169 wl12xx_reg_write32(wl, addr, data); 169 wl1251_reg_write32(wl, addr, data);
170 170
171 /* Toggle buffer ring */ 171 /* Toggle buffer ring */
172 wl->rx_current_buffer = !wl->rx_current_buffer; 172 wl->rx_current_buffer = !wl->rx_current_buffer;
173} 173}
174 174
175 175
176void wl12xx_rx(struct wl12xx *wl) 176void wl1251_rx(struct wl1251 *wl)
177{ 177{
178 struct wl12xx_rx_descriptor *rx_desc; 178 struct wl1251_rx_descriptor *rx_desc;
179 179
180 if (wl->state != WL12XX_STATE_ON) 180 if (wl->state != WL1251_STATE_ON)
181 return; 181 return;
182 182
183 rx_desc = wl->rx_descriptor; 183 rx_desc = wl->rx_descriptor;
184 184
185 /* We first read the frame's header */ 185 /* We first read the frame's header */
186 wl12xx_rx_header(wl, rx_desc); 186 wl1251_rx_header(wl, rx_desc);
187 187
188 /* Now we can read the body */ 188 /* Now we can read the body */
189 wl12xx_rx_body(wl, rx_desc); 189 wl1251_rx_body(wl, rx_desc);
190 190
191 /* Finally, we need to ACK the RX */ 191 /* Finally, we need to ACK the RX */
192 wl12xx_rx_ack(wl); 192 wl1251_rx_ack(wl);
193 193
194 return; 194 return;
195} 195}
diff --git a/drivers/net/wireless/wl12xx/wl1251_rx.h b/drivers/net/wireless/wl12xx/wl1251_rx.h
index 4379c539538..81156b9c475 100644
--- a/drivers/net/wireless/wl12xx/wl1251_rx.h
+++ b/drivers/net/wireless/wl12xx/wl1251_rx.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (c) 1998-2007 Texas Instruments Incorporated 4 * Copyright (c) 1998-2007 Texas Instruments Incorporated
5 * Copyright (C) 2008 Nokia Corporation 5 * Copyright (C) 2008 Nokia Corporation
@@ -22,8 +22,8 @@
22 * 22 *
23 */ 23 */
24 24
25#ifndef __WL12XX_RX_H__ 25#ifndef __WL1251_RX_H__
26#define __WL12XX_RX_H__ 26#define __WL1251_RX_H__
27 27
28#include <linux/bitops.h> 28#include <linux/bitops.h>
29 29
@@ -45,12 +45,12 @@
45 * 4) The target prepares the next RX packet. 45 * 4) The target prepares the next RX packet.
46 */ 46 */
47 47
48#define WL12XX_RX_MAX_RSSI -30 48#define WL1251_RX_MAX_RSSI -30
49#define WL12XX_RX_MIN_RSSI -95 49#define WL1251_RX_MIN_RSSI -95
50 50
51#define WL12XX_RX_ALIGN_TO 4 51#define WL1251_RX_ALIGN_TO 4
52#define WL12XX_RX_ALIGN(len) (((len) + WL12XX_RX_ALIGN_TO - 1) & \ 52#define WL1251_RX_ALIGN(len) (((len) + WL1251_RX_ALIGN_TO - 1) & \
53 ~(WL12XX_RX_ALIGN_TO - 1)) 53 ~(WL1251_RX_ALIGN_TO - 1))
54 54
55#define SHORT_PREAMBLE_BIT BIT(0) 55#define SHORT_PREAMBLE_BIT BIT(0)
56#define OFDM_RATE_BIT BIT(6) 56#define OFDM_RATE_BIT BIT(6)
@@ -74,7 +74,7 @@
74#define RX_DESC_MIC_FAIL 0x2000 74#define RX_DESC_MIC_FAIL 0x2000
75#define RX_DESC_DECRYPT_FAIL 0x4000 75#define RX_DESC_DECRYPT_FAIL 0x4000
76 76
77struct wl12xx_rx_descriptor { 77struct wl1251_rx_descriptor {
78 u32 timestamp; /* In microseconds */ 78 u32 timestamp; /* In microseconds */
79 u16 length; /* Paylod length, including headers */ 79 u16 length; /* Paylod length, including headers */
80 u16 flags; 80 u16 flags;
@@ -119,6 +119,6 @@ struct wl12xx_rx_descriptor {
119 u8 snr; /* in dB */ 119 u8 snr; /* in dB */
120} __attribute__ ((packed)); 120} __attribute__ ((packed));
121 121
122void wl12xx_rx(struct wl12xx *wl); 122void wl1251_rx(struct wl1251 *wl);
123 123
124#endif 124#endif
diff --git a/drivers/net/wireless/wl12xx/wl1251_spi.c b/drivers/net/wireless/wl12xx/wl1251_spi.c
index 5b4889e351d..c5da79dbc49 100644
--- a/drivers/net/wireless/wl12xx/wl1251_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1251_spi.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (C) 2008 Nokia Corporation 4 * Copyright (C) 2008 Nokia Corporation
5 * 5 *
@@ -26,11 +26,10 @@
26#include <linux/spi/spi.h> 26#include <linux/spi/spi.h>
27 27
28#include "wl1251.h" 28#include "wl1251.h"
29#include "wl12xx_80211.h"
30#include "reg.h" 29#include "reg.h"
31#include "wl1251_spi.h" 30#include "wl1251_spi.h"
32 31
33static int wl12xx_translate_reg_addr(struct wl12xx *wl, int addr) 32static int wl1251_translate_reg_addr(struct wl1251 *wl, int addr)
34{ 33{
35 /* If the address is lower than REGISTERS_BASE, it means that this is 34 /* If the address is lower than REGISTERS_BASE, it means that this is
36 * a chip-specific register address, so look it up in the registers 35 * a chip-specific register address, so look it up in the registers
@@ -38,7 +37,7 @@ static int wl12xx_translate_reg_addr(struct wl12xx *wl, int addr)
38 if (addr < REGISTERS_BASE) { 37 if (addr < REGISTERS_BASE) {
39 /* Make sure we don't go over the table */ 38 /* Make sure we don't go over the table */
40 if (addr >= ACX_REG_TABLE_LEN) { 39 if (addr >= ACX_REG_TABLE_LEN) {
41 wl12xx_error("address out of range (%d)", addr); 40 wl1251_error("address out of range (%d)", addr);
42 return -EINVAL; 41 return -EINVAL;
43 } 42 }
44 addr = wl->chip.acx_reg_table[addr]; 43 addr = wl->chip.acx_reg_table[addr];
@@ -47,13 +46,13 @@ static int wl12xx_translate_reg_addr(struct wl12xx *wl, int addr)
47 return addr - wl->physical_reg_addr + wl->virtual_reg_addr; 46 return addr - wl->physical_reg_addr + wl->virtual_reg_addr;
48} 47}
49 48
50static int wl12xx_translate_mem_addr(struct wl12xx *wl, int addr) 49static int wl1251_translate_mem_addr(struct wl1251 *wl, int addr)
51{ 50{
52 return addr - wl->physical_mem_addr + wl->virtual_mem_addr; 51 return addr - wl->physical_mem_addr + wl->virtual_mem_addr;
53} 52}
54 53
55 54
56void wl12xx_spi_reset(struct wl12xx *wl) 55void wl1251_spi_reset(struct wl1251 *wl)
57{ 56{
58 u8 *cmd; 57 u8 *cmd;
59 struct spi_transfer t; 58 struct spi_transfer t;
@@ -61,7 +60,7 @@ void wl12xx_spi_reset(struct wl12xx *wl)
61 60
62 cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); 61 cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL);
63 if (!cmd) { 62 if (!cmd) {
64 wl12xx_error("could not allocate cmd for spi reset"); 63 wl1251_error("could not allocate cmd for spi reset");
65 return; 64 return;
66 } 65 }
67 66
@@ -76,10 +75,10 @@ void wl12xx_spi_reset(struct wl12xx *wl)
76 75
77 spi_sync(wl->spi, &m); 76 spi_sync(wl->spi, &m);
78 77
79 wl12xx_dump(DEBUG_SPI, "spi reset -> ", cmd, WSPI_INIT_CMD_LEN); 78 wl1251_dump(DEBUG_SPI, "spi reset -> ", cmd, WSPI_INIT_CMD_LEN);
80} 79}
81 80
82void wl12xx_spi_init(struct wl12xx *wl) 81void wl1251_spi_init(struct wl1251 *wl)
83{ 82{
84 u8 crc[WSPI_INIT_CMD_CRC_LEN], *cmd; 83 u8 crc[WSPI_INIT_CMD_CRC_LEN], *cmd;
85 struct spi_transfer t; 84 struct spi_transfer t;
@@ -87,7 +86,7 @@ void wl12xx_spi_init(struct wl12xx *wl)
87 86
88 cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); 87 cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL);
89 if (!cmd) { 88 if (!cmd) {
90 wl12xx_error("could not allocate cmd for spi init"); 89 wl1251_error("could not allocate cmd for spi init");
91 return; 90 return;
92 } 91 }
93 92
@@ -130,7 +129,7 @@ void wl12xx_spi_init(struct wl12xx *wl)
130 129
131 spi_sync(wl->spi, &m); 130 spi_sync(wl->spi, &m);
132 131
133 wl12xx_dump(DEBUG_SPI, "spi init -> ", cmd, WSPI_INIT_CMD_LEN); 132 wl1251_dump(DEBUG_SPI, "spi init -> ", cmd, WSPI_INIT_CMD_LEN);
134} 133}
135 134
136/* Set the SPI partitions to access the chip addresses 135/* Set the SPI partitions to access the chip addresses
@@ -166,18 +165,18 @@ void wl12xx_spi_init(struct wl12xx *wl)
166 * | | 165 * | |
167 * 166 *
168 */ 167 */
169int wl12xx_set_partition(struct wl12xx *wl, 168int wl1251_set_partition(struct wl1251 *wl,
170 u32 mem_start, u32 mem_size, 169 u32 mem_start, u32 mem_size,
171 u32 reg_start, u32 reg_size) 170 u32 reg_start, u32 reg_size)
172{ 171{
173 struct wl12xx_partition *partition; 172 struct wl1251_partition *partition;
174 struct spi_transfer t; 173 struct spi_transfer t;
175 struct spi_message m; 174 struct spi_message m;
176 size_t len, cmd_len; 175 size_t len, cmd_len;
177 u32 *cmd; 176 u32 *cmd;
178 int addr; 177 int addr;
179 178
180 cmd_len = sizeof(u32) + 2 * sizeof(struct wl12xx_partition); 179 cmd_len = sizeof(u32) + 2 * sizeof(struct wl1251_partition);
181 cmd = kzalloc(cmd_len, GFP_KERNEL); 180 cmd = kzalloc(cmd_len, GFP_KERNEL);
182 if (!cmd) 181 if (!cmd)
183 return -ENOMEM; 182 return -ENOMEM;
@@ -185,28 +184,28 @@ int wl12xx_set_partition(struct wl12xx *wl,
185 spi_message_init(&m); 184 spi_message_init(&m);
186 memset(&t, 0, sizeof(t)); 185 memset(&t, 0, sizeof(t));
187 186
188 partition = (struct wl12xx_partition *) (cmd + 1); 187 partition = (struct wl1251_partition *) (cmd + 1);
189 addr = HW_ACCESS_PART0_SIZE_ADDR; 188 addr = HW_ACCESS_PART0_SIZE_ADDR;
190 len = 2 * sizeof(struct wl12xx_partition); 189 len = 2 * sizeof(struct wl1251_partition);
191 190
192 *cmd |= WSPI_CMD_WRITE; 191 *cmd |= WSPI_CMD_WRITE;
193 *cmd |= (len << WSPI_CMD_BYTE_LENGTH_OFFSET) & WSPI_CMD_BYTE_LENGTH; 192 *cmd |= (len << WSPI_CMD_BYTE_LENGTH_OFFSET) & WSPI_CMD_BYTE_LENGTH;
194 *cmd |= addr & WSPI_CMD_BYTE_ADDR; 193 *cmd |= addr & WSPI_CMD_BYTE_ADDR;
195 194
196 wl12xx_debug(DEBUG_SPI, "mem_start %08X mem_size %08X", 195 wl1251_debug(DEBUG_SPI, "mem_start %08X mem_size %08X",
197 mem_start, mem_size); 196 mem_start, mem_size);
198 wl12xx_debug(DEBUG_SPI, "reg_start %08X reg_size %08X", 197 wl1251_debug(DEBUG_SPI, "reg_start %08X reg_size %08X",
199 reg_start, reg_size); 198 reg_start, reg_size);
200 199
201 /* Make sure that the two partitions together don't exceed the 200 /* Make sure that the two partitions together don't exceed the
202 * address range */ 201 * address range */
203 if ((mem_size + reg_size) > HW_ACCESS_MEMORY_MAX_RANGE) { 202 if ((mem_size + reg_size) > HW_ACCESS_MEMORY_MAX_RANGE) {
204 wl12xx_debug(DEBUG_SPI, "Total size exceeds maximum virtual" 203 wl1251_debug(DEBUG_SPI, "Total size exceeds maximum virtual"
205 " address range. Truncating partition[0]."); 204 " address range. Truncating partition[0].");
206 mem_size = HW_ACCESS_MEMORY_MAX_RANGE - reg_size; 205 mem_size = HW_ACCESS_MEMORY_MAX_RANGE - reg_size;
207 wl12xx_debug(DEBUG_SPI, "mem_start %08X mem_size %08X", 206 wl1251_debug(DEBUG_SPI, "mem_start %08X mem_size %08X",
208 mem_start, mem_size); 207 mem_start, mem_size);
209 wl12xx_debug(DEBUG_SPI, "reg_start %08X reg_size %08X", 208 wl1251_debug(DEBUG_SPI, "reg_start %08X reg_size %08X",
210 reg_start, reg_size); 209 reg_start, reg_size);
211 } 210 }
212 211
@@ -214,23 +213,23 @@ int wl12xx_set_partition(struct wl12xx *wl,
214 ((mem_start + mem_size) > reg_start)) { 213 ((mem_start + mem_size) > reg_start)) {
215 /* Guarantee that the memory partition doesn't overlap the 214 /* Guarantee that the memory partition doesn't overlap the
216 * registers partition */ 215 * registers partition */
217 wl12xx_debug(DEBUG_SPI, "End of partition[0] is " 216 wl1251_debug(DEBUG_SPI, "End of partition[0] is "
218 "overlapping partition[1]. Adjusted."); 217 "overlapping partition[1]. Adjusted.");
219 mem_size = reg_start - mem_start; 218 mem_size = reg_start - mem_start;
220 wl12xx_debug(DEBUG_SPI, "mem_start %08X mem_size %08X", 219 wl1251_debug(DEBUG_SPI, "mem_start %08X mem_size %08X",
221 mem_start, mem_size); 220 mem_start, mem_size);
222 wl12xx_debug(DEBUG_SPI, "reg_start %08X reg_size %08X", 221 wl1251_debug(DEBUG_SPI, "reg_start %08X reg_size %08X",
223 reg_start, reg_size); 222 reg_start, reg_size);
224 } else if ((reg_start < mem_start) && 223 } else if ((reg_start < mem_start) &&
225 ((reg_start + reg_size) > mem_start)) { 224 ((reg_start + reg_size) > mem_start)) {
226 /* Guarantee that the register partition doesn't overlap the 225 /* Guarantee that the register partition doesn't overlap the
227 * memory partition */ 226 * memory partition */
228 wl12xx_debug(DEBUG_SPI, "End of partition[1] is" 227 wl1251_debug(DEBUG_SPI, "End of partition[1] is"
229 " overlapping partition[0]. Adjusted."); 228 " overlapping partition[0]. Adjusted.");
230 reg_size = mem_start - reg_start; 229 reg_size = mem_start - reg_start;
231 wl12xx_debug(DEBUG_SPI, "mem_start %08X mem_size %08X", 230 wl1251_debug(DEBUG_SPI, "mem_start %08X mem_size %08X",
232 mem_start, mem_size); 231 mem_start, mem_size);
233 wl12xx_debug(DEBUG_SPI, "reg_start %08X reg_size %08X", 232 wl1251_debug(DEBUG_SPI, "reg_start %08X reg_size %08X",
234 reg_start, reg_size); 233 reg_start, reg_size);
235 } 234 }
236 235
@@ -256,7 +255,7 @@ int wl12xx_set_partition(struct wl12xx *wl,
256 return 0; 255 return 0;
257} 256}
258 257
259void wl12xx_spi_read(struct wl12xx *wl, int addr, void *buf, 258void wl1251_spi_read(struct wl1251 *wl, int addr, void *buf,
260 size_t len, bool fixed) 259 size_t len, bool fixed)
261{ 260{
262 struct spi_transfer t[3]; 261 struct spi_transfer t[3];
@@ -284,7 +283,7 @@ void wl12xx_spi_read(struct wl12xx *wl, int addr, void *buf,
284 283
285 /* Busy and non busy words read */ 284 /* Busy and non busy words read */
286 t[1].rx_buf = busy_buf; 285 t[1].rx_buf = busy_buf;
287 t[1].len = WL12XX_BUSY_WORD_LEN; 286 t[1].len = WL1251_BUSY_WORD_LEN;
288 spi_message_add_tail(&t[1], &m); 287 spi_message_add_tail(&t[1], &m);
289 288
290 t[2].rx_buf = buf; 289 t[2].rx_buf = buf;
@@ -295,11 +294,11 @@ void wl12xx_spi_read(struct wl12xx *wl, int addr, void *buf,
295 294
296 /* FIXME: check busy words */ 295 /* FIXME: check busy words */
297 296
298 wl12xx_dump(DEBUG_SPI, "spi_read cmd -> ", cmd, sizeof(*cmd)); 297 wl1251_dump(DEBUG_SPI, "spi_read cmd -> ", cmd, sizeof(*cmd));
299 wl12xx_dump(DEBUG_SPI, "spi_read buf <- ", buf, len); 298 wl1251_dump(DEBUG_SPI, "spi_read buf <- ", buf, len);
300} 299}
301 300
302void wl12xx_spi_write(struct wl12xx *wl, int addr, void *buf, 301void wl1251_spi_write(struct wl1251 *wl, int addr, void *buf,
303 size_t len, bool fixed) 302 size_t len, bool fixed)
304{ 303{
305 struct spi_transfer t[2]; 304 struct spi_transfer t[2];
@@ -329,66 +328,66 @@ void wl12xx_spi_write(struct wl12xx *wl, int addr, void *buf,
329 328
330 spi_sync(wl->spi, &m); 329 spi_sync(wl->spi, &m);
331 330
332 wl12xx_dump(DEBUG_SPI, "spi_write cmd -> ", cmd, sizeof(*cmd)); 331 wl1251_dump(DEBUG_SPI, "spi_write cmd -> ", cmd, sizeof(*cmd));
333 wl12xx_dump(DEBUG_SPI, "spi_write buf -> ", buf, len); 332 wl1251_dump(DEBUG_SPI, "spi_write buf -> ", buf, len);
334} 333}
335 334
336void wl12xx_spi_mem_read(struct wl12xx *wl, int addr, void *buf, 335void wl1251_spi_mem_read(struct wl1251 *wl, int addr, void *buf,
337 size_t len) 336 size_t len)
338{ 337{
339 int physical; 338 int physical;
340 339
341 physical = wl12xx_translate_mem_addr(wl, addr); 340 physical = wl1251_translate_mem_addr(wl, addr);
342 341
343 wl12xx_spi_read(wl, physical, buf, len, false); 342 wl1251_spi_read(wl, physical, buf, len, false);
344} 343}
345 344
346void wl12xx_spi_mem_write(struct wl12xx *wl, int addr, void *buf, 345void wl1251_spi_mem_write(struct wl1251 *wl, int addr, void *buf,
347 size_t len) 346 size_t len)
348{ 347{
349 int physical; 348 int physical;
350 349
351 physical = wl12xx_translate_mem_addr(wl, addr); 350 physical = wl1251_translate_mem_addr(wl, addr);
352 351
353 wl12xx_spi_write(wl, physical, buf, len, false); 352 wl1251_spi_write(wl, physical, buf, len, false);
354} 353}
355 354
356void wl12xx_spi_reg_read(struct wl12xx *wl, int addr, void *buf, size_t len, 355void wl1251_spi_reg_read(struct wl1251 *wl, int addr, void *buf, size_t len,
357 bool fixed) 356 bool fixed)
358{ 357{
359 int physical; 358 int physical;
360 359
361 physical = wl12xx_translate_reg_addr(wl, addr); 360 physical = wl1251_translate_reg_addr(wl, addr);
362 361
363 wl12xx_spi_read(wl, physical, buf, len, fixed); 362 wl1251_spi_read(wl, physical, buf, len, fixed);
364} 363}
365 364
366void wl12xx_spi_reg_write(struct wl12xx *wl, int addr, void *buf, size_t len, 365void wl1251_spi_reg_write(struct wl1251 *wl, int addr, void *buf, size_t len,
367 bool fixed) 366 bool fixed)
368{ 367{
369 int physical; 368 int physical;
370 369
371 physical = wl12xx_translate_reg_addr(wl, addr); 370 physical = wl1251_translate_reg_addr(wl, addr);
372 371
373 wl12xx_spi_write(wl, physical, buf, len, fixed); 372 wl1251_spi_write(wl, physical, buf, len, fixed);
374} 373}
375 374
376u32 wl12xx_mem_read32(struct wl12xx *wl, int addr) 375u32 wl1251_mem_read32(struct wl1251 *wl, int addr)
377{ 376{
378 return wl12xx_read32(wl, wl12xx_translate_mem_addr(wl, addr)); 377 return wl1251_read32(wl, wl1251_translate_mem_addr(wl, addr));
379} 378}
380 379
381void wl12xx_mem_write32(struct wl12xx *wl, int addr, u32 val) 380void wl1251_mem_write32(struct wl1251 *wl, int addr, u32 val)
382{ 381{
383 wl12xx_write32(wl, wl12xx_translate_mem_addr(wl, addr), val); 382 wl1251_write32(wl, wl1251_translate_mem_addr(wl, addr), val);
384} 383}
385 384
386u32 wl12xx_reg_read32(struct wl12xx *wl, int addr) 385u32 wl1251_reg_read32(struct wl1251 *wl, int addr)
387{ 386{
388 return wl12xx_read32(wl, wl12xx_translate_reg_addr(wl, addr)); 387 return wl1251_read32(wl, wl1251_translate_reg_addr(wl, addr));
389} 388}
390 389
391void wl12xx_reg_write32(struct wl12xx *wl, int addr, u32 val) 390void wl1251_reg_write32(struct wl1251 *wl, int addr, u32 val)
392{ 391{
393 wl12xx_write32(wl, wl12xx_translate_reg_addr(wl, addr), val); 392 wl1251_write32(wl, wl1251_translate_reg_addr(wl, addr), val);
394} 393}
diff --git a/drivers/net/wireless/wl12xx/wl1251_spi.h b/drivers/net/wireless/wl12xx/wl1251_spi.h
index 82b009c3e9e..6e8daf4e108 100644
--- a/drivers/net/wireless/wl12xx/wl1251_spi.h
+++ b/drivers/net/wireless/wl12xx/wl1251_spi.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (c) 1998-2007 Texas Instruments Incorporated 4 * Copyright (c) 1998-2007 Texas Instruments Incorporated
5 * Copyright (C) 2008 Nokia Corporation 5 * Copyright (C) 2008 Nokia Corporation
@@ -22,8 +22,8 @@
22 * 22 *
23 */ 23 */
24 24
25#ifndef __WL12XX_SPI_H__ 25#ifndef __WL1251_SPI_H__
26#define __WL12XX_SPI_H__ 26#define __WL1251_SPI_H__
27 27
28#include "wl1251_cmd.h" 28#include "wl1251_cmd.h"
29#include "wl1251_acx.h" 29#include "wl1251_acx.h"
@@ -66,50 +66,50 @@
66#define WSPI_INIT_CMD_LEN 8 66#define WSPI_INIT_CMD_LEN 8
67 67
68#define HW_ACCESS_WSPI_FIXED_BUSY_LEN \ 68#define HW_ACCESS_WSPI_FIXED_BUSY_LEN \
69 ((WL12XX_BUSY_WORD_LEN - 4) / sizeof(u32)) 69 ((WL1251_BUSY_WORD_LEN - 4) / sizeof(u32))
70#define HW_ACCESS_WSPI_INIT_CMD_MASK 0 70#define HW_ACCESS_WSPI_INIT_CMD_MASK 0
71 71
72 72
73/* Raw target IO, address is not translated */ 73/* Raw target IO, address is not translated */
74void wl12xx_spi_write(struct wl12xx *wl, int addr, void *buf, 74void wl1251_spi_write(struct wl1251 *wl, int addr, void *buf,
75 size_t len, bool fixed); 75 size_t len, bool fixed);
76void wl12xx_spi_read(struct wl12xx *wl, int addr, void *buf, 76void wl1251_spi_read(struct wl1251 *wl, int addr, void *buf,
77 size_t len, bool fixed); 77 size_t len, bool fixed);
78 78
79/* Memory target IO, address is tranlated to partition 0 */ 79/* Memory target IO, address is tranlated to partition 0 */
80void wl12xx_spi_mem_read(struct wl12xx *wl, int addr, void *buf, size_t len); 80void wl1251_spi_mem_read(struct wl1251 *wl, int addr, void *buf, size_t len);
81void wl12xx_spi_mem_write(struct wl12xx *wl, int addr, void *buf, size_t len); 81void wl1251_spi_mem_write(struct wl1251 *wl, int addr, void *buf, size_t len);
82u32 wl12xx_mem_read32(struct wl12xx *wl, int addr); 82u32 wl1251_mem_read32(struct wl1251 *wl, int addr);
83void wl12xx_mem_write32(struct wl12xx *wl, int addr, u32 val); 83void wl1251_mem_write32(struct wl1251 *wl, int addr, u32 val);
84 84
85/* Registers IO */ 85/* Registers IO */
86void wl12xx_spi_reg_read(struct wl12xx *wl, int addr, void *buf, size_t len, 86void wl1251_spi_reg_read(struct wl1251 *wl, int addr, void *buf, size_t len,
87 bool fixed); 87 bool fixed);
88void wl12xx_spi_reg_write(struct wl12xx *wl, int addr, void *buf, size_t len, 88void wl1251_spi_reg_write(struct wl1251 *wl, int addr, void *buf, size_t len,
89 bool fixed); 89 bool fixed);
90u32 wl12xx_reg_read32(struct wl12xx *wl, int addr); 90u32 wl1251_reg_read32(struct wl1251 *wl, int addr);
91void wl12xx_reg_write32(struct wl12xx *wl, int addr, u32 val); 91void wl1251_reg_write32(struct wl1251 *wl, int addr, u32 val);
92 92
93/* INIT and RESET words */ 93/* INIT and RESET words */
94void wl12xx_spi_reset(struct wl12xx *wl); 94void wl1251_spi_reset(struct wl1251 *wl);
95void wl12xx_spi_init(struct wl12xx *wl); 95void wl1251_spi_init(struct wl1251 *wl);
96int wl12xx_set_partition(struct wl12xx *wl, 96int wl1251_set_partition(struct wl1251 *wl,
97 u32 part_start, u32 part_size, 97 u32 part_start, u32 part_size,
98 u32 reg_start, u32 reg_size); 98 u32 reg_start, u32 reg_size);
99 99
100static inline u32 wl12xx_read32(struct wl12xx *wl, int addr) 100static inline u32 wl1251_read32(struct wl1251 *wl, int addr)
101{ 101{
102 wl12xx_spi_read(wl, addr, &wl->buffer_32, 102 wl1251_spi_read(wl, addr, &wl->buffer_32,
103 sizeof(wl->buffer_32), false); 103 sizeof(wl->buffer_32), false);
104 104
105 return wl->buffer_32; 105 return wl->buffer_32;
106} 106}
107 107
108static inline void wl12xx_write32(struct wl12xx *wl, int addr, u32 val) 108static inline void wl1251_write32(struct wl1251 *wl, int addr, u32 val)
109{ 109{
110 wl->buffer_32 = val; 110 wl->buffer_32 = val;
111 wl12xx_spi_write(wl, addr, &wl->buffer_32, 111 wl1251_spi_write(wl, addr, &wl->buffer_32,
112 sizeof(wl->buffer_32), false); 112 sizeof(wl->buffer_32), false);
113} 113}
114 114
115#endif /* __WL12XX_SPI_H__ */ 115#endif /* __WL1251_SPI_H__ */
diff --git a/drivers/net/wireless/wl12xx/wl1251_tx.c b/drivers/net/wireless/wl12xx/wl1251_tx.c
index 00c5649d909..2652a222383 100644
--- a/drivers/net/wireless/wl12xx/wl1251_tx.c
+++ b/drivers/net/wireless/wl12xx/wl1251_tx.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (c) 1998-2007 Texas Instruments Incorporated 4 * Copyright (c) 1998-2007 Texas Instruments Incorporated
5 * Copyright (C) 2008 Nokia Corporation 5 * Copyright (C) 2008 Nokia Corporation
@@ -31,7 +31,7 @@
31#include "wl1251_tx.h" 31#include "wl1251_tx.h"
32#include "wl1251_ps.h" 32#include "wl1251_ps.h"
33 33
34static bool wl1251_tx_double_buffer_busy(struct wl12xx *wl, u32 data_out_count) 34static bool wl1251_tx_double_buffer_busy(struct wl1251 *wl, u32 data_out_count)
35{ 35{
36 int used, data_in_count; 36 int used, data_in_count;
37 37
@@ -52,13 +52,13 @@ static bool wl1251_tx_double_buffer_busy(struct wl12xx *wl, u32 data_out_count)
52 return false; 52 return false;
53} 53}
54 54
55static int wl1251_tx_path_status(struct wl12xx *wl) 55static int wl1251_tx_path_status(struct wl1251 *wl)
56{ 56{
57 u32 status, addr, data_out_count; 57 u32 status, addr, data_out_count;
58 bool busy; 58 bool busy;
59 59
60 addr = wl->data_path->tx_control_addr; 60 addr = wl->data_path->tx_control_addr;
61 status = wl12xx_mem_read32(wl, addr); 61 status = wl1251_mem_read32(wl, addr);
62 data_out_count = status & TX_STATUS_DATA_OUT_COUNT_MASK; 62 data_out_count = status & TX_STATUS_DATA_OUT_COUNT_MASK;
63 busy = wl1251_tx_double_buffer_busy(wl, data_out_count); 63 busy = wl1251_tx_double_buffer_busy(wl, data_out_count);
64 64
@@ -68,7 +68,7 @@ static int wl1251_tx_path_status(struct wl12xx *wl)
68 return 0; 68 return 0;
69} 69}
70 70
71static int wl1251_tx_id(struct wl12xx *wl, struct sk_buff *skb) 71static int wl1251_tx_id(struct wl1251 *wl, struct sk_buff *skb)
72{ 72{
73 int i; 73 int i;
74 74
@@ -142,7 +142,7 @@ static void wl1251_tx_frag_block_num(struct tx_double_buffer_desc *tx_hdr)
142 tx_hdr->num_mem_blocks = mem_blocks; 142 tx_hdr->num_mem_blocks = mem_blocks;
143} 143}
144 144
145static int wl1251_tx_fill_hdr(struct wl12xx *wl, struct sk_buff *skb, 145static int wl1251_tx_fill_hdr(struct wl1251 *wl, struct sk_buff *skb,
146 struct ieee80211_tx_info *control) 146 struct ieee80211_tx_info *control)
147{ 147{
148 struct tx_double_buffer_desc *tx_hdr; 148 struct tx_double_buffer_desc *tx_hdr;
@@ -177,7 +177,7 @@ static int wl1251_tx_fill_hdr(struct wl12xx *wl, struct sk_buff *skb,
177} 177}
178 178
179/* We copy the packet to the target */ 179/* We copy the packet to the target */
180static int wl1251_tx_send_packet(struct wl12xx *wl, struct sk_buff *skb, 180static int wl1251_tx_send_packet(struct wl1251 *wl, struct sk_buff *skb,
181 struct ieee80211_tx_info *control) 181 struct ieee80211_tx_info *control)
182{ 182{
183 struct tx_double_buffer_desc *tx_hdr; 183 struct tx_double_buffer_desc *tx_hdr;
@@ -211,7 +211,7 @@ static int wl1251_tx_send_packet(struct wl12xx *wl, struct sk_buff *skb,
211 */ 211 */
212 if (unlikely((long)skb->data & 0x03)) { 212 if (unlikely((long)skb->data & 0x03)) {
213 int offset = (4 - (long)skb->data) & 0x03; 213 int offset = (4 - (long)skb->data) & 0x03;
214 wl12xx_debug(DEBUG_TX, "skb offset %d", offset); 214 wl1251_debug(DEBUG_TX, "skb offset %d", offset);
215 215
216 /* check whether the current skb can be used */ 216 /* check whether the current skb can be used */
217 if (!skb_cloned(skb) && (skb_tailroom(skb) >= offset)) { 217 if (!skb_cloned(skb) && (skb_tailroom(skb) >= offset)) {
@@ -221,7 +221,7 @@ static int wl1251_tx_send_packet(struct wl12xx *wl, struct sk_buff *skb,
221 skb_reserve(skb, offset); 221 skb_reserve(skb, offset);
222 memmove(skb->data, src, skb->len); 222 memmove(skb->data, src, skb->len);
223 } else { 223 } else {
224 wl12xx_info("No handler, fixme!"); 224 wl1251_info("No handler, fixme!");
225 return -EINVAL; 225 return -EINVAL;
226 } 226 }
227 } 227 }
@@ -235,15 +235,15 @@ static int wl1251_tx_send_packet(struct wl12xx *wl, struct sk_buff *skb,
235 else 235 else
236 addr = wl->data_path->tx_packet_ring_addr; 236 addr = wl->data_path->tx_packet_ring_addr;
237 237
238 wl12xx_spi_mem_write(wl, addr, skb->data, len); 238 wl1251_spi_mem_write(wl, addr, skb->data, len);
239 239
240 wl12xx_debug(DEBUG_TX, "tx id %u skb 0x%p payload %u rate 0x%x", 240 wl1251_debug(DEBUG_TX, "tx id %u skb 0x%p payload %u rate 0x%x",
241 tx_hdr->id, skb, tx_hdr->length, tx_hdr->rate); 241 tx_hdr->id, skb, tx_hdr->length, tx_hdr->rate);
242 242
243 return 0; 243 return 0;
244} 244}
245 245
246static void wl1251_tx_trigger(struct wl12xx *wl) 246static void wl1251_tx_trigger(struct wl1251 *wl)
247{ 247{
248 u32 data, addr; 248 u32 data, addr;
249 249
@@ -255,7 +255,7 @@ static void wl1251_tx_trigger(struct wl12xx *wl)
255 data = INTR_TRIG_TX_PROC0; 255 data = INTR_TRIG_TX_PROC0;
256 } 256 }
257 257
258 wl12xx_reg_write32(wl, addr, data); 258 wl1251_reg_write32(wl, addr, data);
259 259
260 /* Bumping data in */ 260 /* Bumping data in */
261 wl->data_in_count = (wl->data_in_count + 1) & 261 wl->data_in_count = (wl->data_in_count + 1) &
@@ -263,7 +263,7 @@ static void wl1251_tx_trigger(struct wl12xx *wl)
263} 263}
264 264
265/* caller must hold wl->mutex */ 265/* caller must hold wl->mutex */
266static int wl1251_tx_frame(struct wl12xx *wl, struct sk_buff *skb) 266static int wl1251_tx_frame(struct wl1251 *wl, struct sk_buff *skb)
267{ 267{
268 struct ieee80211_tx_info *info; 268 struct ieee80211_tx_info *info;
269 int ret = 0; 269 int ret = 0;
@@ -274,7 +274,7 @@ static int wl1251_tx_frame(struct wl12xx *wl, struct sk_buff *skb)
274 if (info->control.hw_key) { 274 if (info->control.hw_key) {
275 idx = info->control.hw_key->hw_key_idx; 275 idx = info->control.hw_key->hw_key_idx;
276 if (unlikely(wl->default_key != idx)) { 276 if (unlikely(wl->default_key != idx)) {
277 ret = wl12xx_acx_default_key(wl, idx); 277 ret = wl1251_acx_default_key(wl, idx);
278 if (ret < 0) 278 if (ret < 0)
279 return ret; 279 return ret;
280 } 280 }
@@ -299,19 +299,19 @@ static int wl1251_tx_frame(struct wl12xx *wl, struct sk_buff *skb)
299 299
300void wl1251_tx_work(struct work_struct *work) 300void wl1251_tx_work(struct work_struct *work)
301{ 301{
302 struct wl12xx *wl = container_of(work, struct wl12xx, tx_work); 302 struct wl1251 *wl = container_of(work, struct wl1251, tx_work);
303 struct sk_buff *skb; 303 struct sk_buff *skb;
304 bool woken_up = false; 304 bool woken_up = false;
305 int ret; 305 int ret;
306 306
307 mutex_lock(&wl->mutex); 307 mutex_lock(&wl->mutex);
308 308
309 if (unlikely(wl->state == WL12XX_STATE_OFF)) 309 if (unlikely(wl->state == WL1251_STATE_OFF))
310 goto out; 310 goto out;
311 311
312 while ((skb = skb_dequeue(&wl->tx_queue))) { 312 while ((skb = skb_dequeue(&wl->tx_queue))) {
313 if (!woken_up) { 313 if (!woken_up) {
314 ret = wl12xx_ps_elp_wakeup(wl); 314 ret = wl1251_ps_elp_wakeup(wl);
315 if (ret < 0) 315 if (ret < 0)
316 goto out; 316 goto out;
317 woken_up = true; 317 woken_up = true;
@@ -320,7 +320,7 @@ void wl1251_tx_work(struct work_struct *work)
320 ret = wl1251_tx_frame(wl, skb); 320 ret = wl1251_tx_frame(wl, skb);
321 if (ret == -EBUSY) { 321 if (ret == -EBUSY) {
322 /* firmware buffer is full, stop queues */ 322 /* firmware buffer is full, stop queues */
323 wl12xx_debug(DEBUG_TX, "tx_work: fw buffer full, " 323 wl1251_debug(DEBUG_TX, "tx_work: fw buffer full, "
324 "stop queues"); 324 "stop queues");
325 ieee80211_stop_queues(wl->hw); 325 ieee80211_stop_queues(wl->hw);
326 wl->tx_queue_stopped = true; 326 wl->tx_queue_stopped = true;
@@ -334,7 +334,7 @@ void wl1251_tx_work(struct work_struct *work)
334 334
335out: 335out:
336 if (woken_up) 336 if (woken_up)
337 wl12xx_ps_elp_sleep(wl); 337 wl1251_ps_elp_sleep(wl);
338 338
339 mutex_unlock(&wl->mutex); 339 mutex_unlock(&wl->mutex);
340} 340}
@@ -367,7 +367,7 @@ static const char *wl1251_tx_parse_status(u8 status)
367 return buf; 367 return buf;
368} 368}
369 369
370static void wl1251_tx_packet_cb(struct wl12xx *wl, 370static void wl1251_tx_packet_cb(struct wl1251 *wl,
371 struct tx_result *result) 371 struct tx_result *result)
372{ 372{
373 struct ieee80211_tx_info *info; 373 struct ieee80211_tx_info *info;
@@ -377,7 +377,7 @@ static void wl1251_tx_packet_cb(struct wl12xx *wl,
377 377
378 skb = wl->tx_frames[result->id]; 378 skb = wl->tx_frames[result->id];
379 if (skb == NULL) { 379 if (skb == NULL) {
380 wl12xx_error("SKB for packet %d is NULL", result->id); 380 wl1251_error("SKB for packet %d is NULL", result->id);
381 return; 381 return;
382 } 382 }
383 383
@@ -402,7 +402,7 @@ static void wl1251_tx_packet_cb(struct wl12xx *wl,
402 skb_pull(skb, WL1251_TKIP_IV_SPACE); 402 skb_pull(skb, WL1251_TKIP_IV_SPACE);
403 } 403 }
404 404
405 wl12xx_debug(DEBUG_TX, "tx status id %u skb 0x%p failures %u rate 0x%x" 405 wl1251_debug(DEBUG_TX, "tx status id %u skb 0x%p failures %u rate 0x%x"
406 " status 0x%x (%s)", 406 " status 0x%x (%s)",
407 result->id, skb, result->ack_failures, result->rate, 407 result->id, skb, result->ack_failures, result->rate,
408 result->status, wl1251_tx_parse_status(result->status)); 408 result->status, wl1251_tx_parse_status(result->status));
@@ -413,7 +413,7 @@ static void wl1251_tx_packet_cb(struct wl12xx *wl,
413 wl->tx_frames[result->id] = NULL; 413 wl->tx_frames[result->id] = NULL;
414 414
415 if (wl->tx_queue_stopped) { 415 if (wl->tx_queue_stopped) {
416 wl12xx_debug(DEBUG_TX, "cb: queue was stopped"); 416 wl1251_debug(DEBUG_TX, "cb: queue was stopped");
417 417
418 skb = skb_dequeue(&wl->tx_queue); 418 skb = skb_dequeue(&wl->tx_queue);
419 419
@@ -425,7 +425,7 @@ static void wl1251_tx_packet_cb(struct wl12xx *wl,
425 ret = wl1251_tx_frame(wl, skb); 425 ret = wl1251_tx_frame(wl, skb);
426 if (ret == -EBUSY) { 426 if (ret == -EBUSY) {
427 /* firmware buffer is still full */ 427 /* firmware buffer is still full */
428 wl12xx_debug(DEBUG_TX, "cb: fw buffer " 428 wl1251_debug(DEBUG_TX, "cb: fw buffer "
429 "still full"); 429 "still full");
430 skb_queue_head(&wl->tx_queue, skb); 430 skb_queue_head(&wl->tx_queue, skb);
431 return; 431 return;
@@ -435,23 +435,23 @@ static void wl1251_tx_packet_cb(struct wl12xx *wl,
435 } 435 }
436 } 436 }
437 437
438 wl12xx_debug(DEBUG_TX, "cb: waking queues"); 438 wl1251_debug(DEBUG_TX, "cb: waking queues");
439 ieee80211_wake_queues(wl->hw); 439 ieee80211_wake_queues(wl->hw);
440 wl->tx_queue_stopped = false; 440 wl->tx_queue_stopped = false;
441 } 441 }
442} 442}
443 443
444/* Called upon reception of a TX complete interrupt */ 444/* Called upon reception of a TX complete interrupt */
445void wl1251_tx_complete(struct wl12xx *wl) 445void wl1251_tx_complete(struct wl1251 *wl)
446{ 446{
447 int i, result_index, num_complete = 0; 447 int i, result_index, num_complete = 0;
448 struct tx_result result[FW_TX_CMPLT_BLOCK_SIZE], *result_ptr; 448 struct tx_result result[FW_TX_CMPLT_BLOCK_SIZE], *result_ptr;
449 449
450 if (unlikely(wl->state != WL12XX_STATE_ON)) 450 if (unlikely(wl->state != WL1251_STATE_ON))
451 return; 451 return;
452 452
453 /* First we read the result */ 453 /* First we read the result */
454 wl12xx_spi_mem_read(wl, wl->data_path->tx_complete_addr, 454 wl1251_spi_mem_read(wl, wl->data_path->tx_complete_addr,
455 result, sizeof(result)); 455 result, sizeof(result));
456 456
457 result_index = wl->next_tx_complete; 457 result_index = wl->next_tx_complete;
@@ -482,7 +482,7 @@ void wl1251_tx_complete(struct wl12xx *wl)
482 */ 482 */
483 if (result_index > wl->next_tx_complete) { 483 if (result_index > wl->next_tx_complete) {
484 /* Only 1 write is needed */ 484 /* Only 1 write is needed */
485 wl12xx_spi_mem_write(wl, 485 wl1251_spi_mem_write(wl,
486 wl->data_path->tx_complete_addr + 486 wl->data_path->tx_complete_addr +
487 (wl->next_tx_complete * 487 (wl->next_tx_complete *
488 sizeof(struct tx_result)), 488 sizeof(struct tx_result)),
@@ -493,7 +493,7 @@ void wl1251_tx_complete(struct wl12xx *wl)
493 493
494 } else if (result_index < wl->next_tx_complete) { 494 } else if (result_index < wl->next_tx_complete) {
495 /* 2 writes are needed */ 495 /* 2 writes are needed */
496 wl12xx_spi_mem_write(wl, 496 wl1251_spi_mem_write(wl,
497 wl->data_path->tx_complete_addr + 497 wl->data_path->tx_complete_addr +
498 (wl->next_tx_complete * 498 (wl->next_tx_complete *
499 sizeof(struct tx_result)), 499 sizeof(struct tx_result)),
@@ -502,7 +502,7 @@ void wl1251_tx_complete(struct wl12xx *wl)
502 wl->next_tx_complete) * 502 wl->next_tx_complete) *
503 sizeof(struct tx_result)); 503 sizeof(struct tx_result));
504 504
505 wl12xx_spi_mem_write(wl, 505 wl1251_spi_mem_write(wl,
506 wl->data_path->tx_complete_addr, 506 wl->data_path->tx_complete_addr,
507 result, 507 result,
508 (num_complete - 508 (num_complete -
@@ -512,7 +512,7 @@ void wl1251_tx_complete(struct wl12xx *wl)
512 512
513 } else { 513 } else {
514 /* We have to write the whole array */ 514 /* We have to write the whole array */
515 wl12xx_spi_mem_write(wl, 515 wl1251_spi_mem_write(wl,
516 wl->data_path->tx_complete_addr, 516 wl->data_path->tx_complete_addr,
517 result, 517 result,
518 FW_TX_CMPLT_BLOCK_SIZE * 518 FW_TX_CMPLT_BLOCK_SIZE *
@@ -525,7 +525,7 @@ void wl1251_tx_complete(struct wl12xx *wl)
525} 525}
526 526
527/* caller must hold wl->mutex */ 527/* caller must hold wl->mutex */
528void wl1251_tx_flush(struct wl12xx *wl) 528void wl1251_tx_flush(struct wl1251 *wl)
529{ 529{
530 int i; 530 int i;
531 struct sk_buff *skb; 531 struct sk_buff *skb;
@@ -537,7 +537,7 @@ void wl1251_tx_flush(struct wl12xx *wl)
537 while ((skb = skb_dequeue(&wl->tx_queue))) { 537 while ((skb = skb_dequeue(&wl->tx_queue))) {
538 info = IEEE80211_SKB_CB(skb); 538 info = IEEE80211_SKB_CB(skb);
539 539
540 wl12xx_debug(DEBUG_TX, "flushing skb 0x%p", skb); 540 wl1251_debug(DEBUG_TX, "flushing skb 0x%p", skb);
541 541
542 if (!(info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)) 542 if (!(info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS))
543 continue; 543 continue;
diff --git a/drivers/net/wireless/wl12xx/wl1251_tx.h b/drivers/net/wireless/wl12xx/wl1251_tx.h
index a5d4c825905..7c1c1665c81 100644
--- a/drivers/net/wireless/wl12xx/wl1251_tx.h
+++ b/drivers/net/wireless/wl12xx/wl1251_tx.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (c) 1998-2007 Texas Instruments Incorporated 4 * Copyright (c) 1998-2007 Texas Instruments Incorporated
5 * Copyright (C) 2008 Nokia Corporation 5 * Copyright (C) 2008 Nokia Corporation
@@ -210,7 +210,7 @@ struct tx_result {
210} __attribute__ ((packed)); 210} __attribute__ ((packed));
211 211
212void wl1251_tx_work(struct work_struct *work); 212void wl1251_tx_work(struct work_struct *work);
213void wl1251_tx_complete(struct wl12xx *wl); 213void wl1251_tx_complete(struct wl1251 *wl);
214void wl1251_tx_flush(struct wl12xx *wl); 214void wl1251_tx_flush(struct wl1251 *wl);
215 215
216#endif 216#endif