diff options
Diffstat (limited to 'drivers/net/wireless/atmel.c')
-rw-r--r-- | drivers/net/wireless/atmel.c | 443 |
1 files changed, 242 insertions, 201 deletions
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 91930a2c3c6b..b06835a621a3 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c | |||
@@ -2,8 +2,8 @@ | |||
2 | 2 | ||
3 | Driver for Atmel at76c502 at76c504 and at76c506 wireless cards. | 3 | Driver for Atmel at76c502 at76c504 and at76c506 wireless cards. |
4 | 4 | ||
5 | Copyright 2000-2001 ATMEL Corporation. | 5 | Copyright 2000-2001 ATMEL Corporation. |
6 | Copyright 2003-2004 Simon Kelley. | 6 | Copyright 2003-2004 Simon Kelley. |
7 | 7 | ||
8 | This code was developed from version 2.1.1 of the Atmel drivers, | 8 | This code was developed from version 2.1.1 of the Atmel drivers, |
9 | released by Atmel corp. under the GPL in December 2002. It also | 9 | released by Atmel corp. under the GPL in December 2002. It also |
@@ -89,15 +89,15 @@ static struct { | |||
89 | const char *fw_file; | 89 | const char *fw_file; |
90 | const char *fw_file_ext; | 90 | const char *fw_file_ext; |
91 | } fw_table[] = { | 91 | } fw_table[] = { |
92 | { ATMEL_FW_TYPE_502, "atmel_at76c502", "bin" }, | 92 | { ATMEL_FW_TYPE_502, "atmel_at76c502", "bin" }, |
93 | { ATMEL_FW_TYPE_502D, "atmel_at76c502d", "bin" }, | 93 | { ATMEL_FW_TYPE_502D, "atmel_at76c502d", "bin" }, |
94 | { ATMEL_FW_TYPE_502E, "atmel_at76c502e", "bin" }, | 94 | { ATMEL_FW_TYPE_502E, "atmel_at76c502e", "bin" }, |
95 | { ATMEL_FW_TYPE_502_3COM, "atmel_at76c502_3com", "bin" }, | 95 | { ATMEL_FW_TYPE_502_3COM, "atmel_at76c502_3com", "bin" }, |
96 | { ATMEL_FW_TYPE_504, "atmel_at76c504", "bin" }, | 96 | { ATMEL_FW_TYPE_504, "atmel_at76c504", "bin" }, |
97 | { ATMEL_FW_TYPE_504_2958, "atmel_at76c504_2958", "bin" }, | 97 | { ATMEL_FW_TYPE_504_2958, "atmel_at76c504_2958", "bin" }, |
98 | { ATMEL_FW_TYPE_504A_2958,"atmel_at76c504a_2958","bin" }, | 98 | { ATMEL_FW_TYPE_504A_2958, "atmel_at76c504a_2958", "bin" }, |
99 | { ATMEL_FW_TYPE_506, "atmel_at76c506", "bin" }, | 99 | { ATMEL_FW_TYPE_506, "atmel_at76c506", "bin" }, |
100 | { ATMEL_FW_TYPE_NONE, NULL, NULL } | 100 | { ATMEL_FW_TYPE_NONE, NULL, NULL } |
101 | }; | 101 | }; |
102 | 102 | ||
103 | #define MAX_SSID_LENGTH 32 | 103 | #define MAX_SSID_LENGTH 32 |
@@ -106,60 +106,60 @@ static struct { | |||
106 | #define MAX_BSS_ENTRIES 64 | 106 | #define MAX_BSS_ENTRIES 64 |
107 | 107 | ||
108 | /* registers */ | 108 | /* registers */ |
109 | #define GCR 0x00 // (SIR0) General Configuration Register | 109 | #define GCR 0x00 /* (SIR0) General Configuration Register */ |
110 | #define BSR 0x02 // (SIR1) Bank Switching Select Register | 110 | #define BSR 0x02 /* (SIR1) Bank Switching Select Register */ |
111 | #define AR 0x04 | 111 | #define AR 0x04 |
112 | #define DR 0x08 | 112 | #define DR 0x08 |
113 | #define MR1 0x12 // Mirror Register 1 | 113 | #define MR1 0x12 /* Mirror Register 1 */ |
114 | #define MR2 0x14 // Mirror Register 2 | 114 | #define MR2 0x14 /* Mirror Register 2 */ |
115 | #define MR3 0x16 // Mirror Register 3 | 115 | #define MR3 0x16 /* Mirror Register 3 */ |
116 | #define MR4 0x18 // Mirror Register 4 | 116 | #define MR4 0x18 /* Mirror Register 4 */ |
117 | 117 | ||
118 | #define GPR1 0x0c | 118 | #define GPR1 0x0c |
119 | #define GPR2 0x0e | 119 | #define GPR2 0x0e |
120 | #define GPR3 0x10 | 120 | #define GPR3 0x10 |
121 | // | 121 | /* |
122 | // Constants for the GCR register. | 122 | * Constants for the GCR register. |
123 | // | 123 | */ |
124 | #define GCR_REMAP 0x0400 // Remap internal SRAM to 0 | 124 | #define GCR_REMAP 0x0400 /* Remap internal SRAM to 0 */ |
125 | #define GCR_SWRES 0x0080 // BIU reset (ARM and PAI are NOT reset) | 125 | #define GCR_SWRES 0x0080 /* BIU reset (ARM and PAI are NOT reset) */ |
126 | #define GCR_CORES 0x0060 // Core Reset (ARM and PAI are reset) | 126 | #define GCR_CORES 0x0060 /* Core Reset (ARM and PAI are reset) */ |
127 | #define GCR_ENINT 0x0002 // Enable Interrupts | 127 | #define GCR_ENINT 0x0002 /* Enable Interrupts */ |
128 | #define GCR_ACKINT 0x0008 // Acknowledge Interrupts | 128 | #define GCR_ACKINT 0x0008 /* Acknowledge Interrupts */ |
129 | 129 | ||
130 | #define BSS_SRAM 0x0200 // AMBA module selection --> SRAM | 130 | #define BSS_SRAM 0x0200 /* AMBA module selection --> SRAM */ |
131 | #define BSS_IRAM 0x0100 // AMBA module selection --> IRAM | 131 | #define BSS_IRAM 0x0100 /* AMBA module selection --> IRAM */ |
132 | // | 132 | /* |
133 | // Constants for the MR registers. | 133 | *Constants for the MR registers. |
134 | // | 134 | */ |
135 | #define MAC_INIT_COMPLETE 0x0001 // MAC init has been completed | 135 | #define MAC_INIT_COMPLETE 0x0001 /* MAC init has been completed */ |
136 | #define MAC_BOOT_COMPLETE 0x0010 // MAC boot has been completed | 136 | #define MAC_BOOT_COMPLETE 0x0010 /* MAC boot has been completed */ |
137 | #define MAC_INIT_OK 0x0002 // MAC boot has been completed | 137 | #define MAC_INIT_OK 0x0002 /* MAC boot has been completed */ |
138 | 138 | ||
139 | #define MIB_MAX_DATA_BYTES 212 | 139 | #define MIB_MAX_DATA_BYTES 212 |
140 | #define MIB_HEADER_SIZE 4 /* first four fields */ | 140 | #define MIB_HEADER_SIZE 4 /* first four fields */ |
141 | 141 | ||
142 | struct get_set_mib { | 142 | struct get_set_mib { |
143 | u8 type; | 143 | u8 type; |
144 | u8 size; | 144 | u8 size; |
145 | u8 index; | 145 | u8 index; |
146 | u8 reserved; | 146 | u8 reserved; |
147 | u8 data[MIB_MAX_DATA_BYTES]; | 147 | u8 data[MIB_MAX_DATA_BYTES]; |
148 | }; | 148 | }; |
149 | 149 | ||
150 | struct rx_desc { | 150 | struct rx_desc { |
151 | u32 Next; | 151 | u32 Next; |
152 | u16 MsduPos; | 152 | u16 MsduPos; |
153 | u16 MsduSize; | 153 | u16 MsduSize; |
154 | 154 | ||
155 | u8 State; | 155 | u8 State; |
156 | u8 Status; | 156 | u8 Status; |
157 | u8 Rate; | 157 | u8 Rate; |
158 | u8 Rssi; | 158 | u8 Rssi; |
159 | u8 LinkQuality; | 159 | u8 LinkQuality; |
160 | u8 PreambleType; | 160 | u8 PreambleType; |
161 | u16 Duration; | 161 | u16 Duration; |
162 | u32 RxTime; | 162 | u32 RxTime; |
163 | }; | 163 | }; |
164 | 164 | ||
165 | #define RX_DESC_FLAG_VALID 0x80 | 165 | #define RX_DESC_FLAG_VALID 0x80 |
@@ -192,7 +192,7 @@ struct tx_desc { | |||
192 | u8 KeyIndex; | 192 | u8 KeyIndex; |
193 | u8 ChiperType; | 193 | u8 ChiperType; |
194 | u8 ChipreLength; | 194 | u8 ChipreLength; |
195 | u8 Reserved1; | 195 | u8 Reserved1; |
196 | 196 | ||
197 | u8 Reserved; | 197 | u8 Reserved; |
198 | u8 PacketType; | 198 | u8 PacketType; |
@@ -212,9 +212,9 @@ struct tx_desc { | |||
212 | #define TX_DESC_PACKET_TYPE_OFFSET 17 | 212 | #define TX_DESC_PACKET_TYPE_OFFSET 17 |
213 | #define TX_DESC_HOST_LENGTH_OFFSET 18 | 213 | #define TX_DESC_HOST_LENGTH_OFFSET 18 |
214 | 214 | ||
215 | /////////////////////////////////////////////////////// | 215 | /* |
216 | // Host-MAC interface | 216 | * Host-MAC interface |
217 | /////////////////////////////////////////////////////// | 217 | */ |
218 | 218 | ||
219 | #define TX_STATUS_SUCCESS 0x00 | 219 | #define TX_STATUS_SUCCESS 0x00 |
220 | 220 | ||
@@ -226,14 +226,14 @@ struct tx_desc { | |||
226 | #define TX_PACKET_TYPE_DATA 0x01 | 226 | #define TX_PACKET_TYPE_DATA 0x01 |
227 | #define TX_PACKET_TYPE_MGMT 0x02 | 227 | #define TX_PACKET_TYPE_MGMT 0x02 |
228 | 228 | ||
229 | #define ISR_EMPTY 0x00 // no bits set in ISR | 229 | #define ISR_EMPTY 0x00 /* no bits set in ISR */ |
230 | #define ISR_TxCOMPLETE 0x01 // packet transmitted | 230 | #define ISR_TxCOMPLETE 0x01 /* packet transmitted */ |
231 | #define ISR_RxCOMPLETE 0x02 // packet received | 231 | #define ISR_RxCOMPLETE 0x02 /* packet received */ |
232 | #define ISR_RxFRAMELOST 0x04 // Rx Frame lost | 232 | #define ISR_RxFRAMELOST 0x04 /* Rx Frame lost */ |
233 | #define ISR_FATAL_ERROR 0x08 // Fatal error | 233 | #define ISR_FATAL_ERROR 0x08 /* Fatal error */ |
234 | #define ISR_COMMAND_COMPLETE 0x10 // command completed | 234 | #define ISR_COMMAND_COMPLETE 0x10 /* command completed */ |
235 | #define ISR_OUT_OF_RANGE 0x20 // command completed | 235 | #define ISR_OUT_OF_RANGE 0x20 /* command completed */ |
236 | #define ISR_IBSS_MERGE 0x40 // (4.1.2.30): IBSS merge | 236 | #define ISR_IBSS_MERGE 0x40 /* (4.1.2.30): IBSS merge */ |
237 | #define ISR_GENERIC_IRQ 0x80 | 237 | #define ISR_GENERIC_IRQ 0x80 |
238 | 238 | ||
239 | #define Local_Mib_Type 0x01 | 239 | #define Local_Mib_Type 0x01 |
@@ -311,22 +311,22 @@ struct tx_desc { | |||
311 | #define MAX_ENCRYPTION_KEYS 4 | 311 | #define MAX_ENCRYPTION_KEYS 4 |
312 | #define MAX_ENCRYPTION_KEY_SIZE 40 | 312 | #define MAX_ENCRYPTION_KEY_SIZE 40 |
313 | 313 | ||
314 | /////////////////////////////////////////////////////////////////////////// | 314 | /* |
315 | // 802.11 related definitions | 315 | * 802.11 related definitions |
316 | /////////////////////////////////////////////////////////////////////////// | 316 | */ |
317 | 317 | ||
318 | // | 318 | /* |
319 | // Regulatory Domains | 319 | * Regulatory Domains |
320 | // | 320 | */ |
321 | 321 | ||
322 | #define REG_DOMAIN_FCC 0x10 //Channels 1-11 USA | 322 | #define REG_DOMAIN_FCC 0x10 /* Channels 1-11 USA */ |
323 | #define REG_DOMAIN_DOC 0x20 //Channel 1-11 Canada | 323 | #define REG_DOMAIN_DOC 0x20 /* Channel 1-11 Canada */ |
324 | #define REG_DOMAIN_ETSI 0x30 //Channel 1-13 Europe (ex Spain/France) | 324 | #define REG_DOMAIN_ETSI 0x30 /* Channel 1-13 Europe (ex Spain/France) */ |
325 | #define REG_DOMAIN_SPAIN 0x31 //Channel 10-11 Spain | 325 | #define REG_DOMAIN_SPAIN 0x31 /* Channel 10-11 Spain */ |
326 | #define REG_DOMAIN_FRANCE 0x32 //Channel 10-13 France | 326 | #define REG_DOMAIN_FRANCE 0x32 /* Channel 10-13 France */ |
327 | #define REG_DOMAIN_MKK 0x40 //Channel 14 Japan | 327 | #define REG_DOMAIN_MKK 0x40 /* Channel 14 Japan */ |
328 | #define REG_DOMAIN_MKK1 0x41 //Channel 1-14 Japan(MKK1) | 328 | #define REG_DOMAIN_MKK1 0x41 /* Channel 1-14 Japan(MKK1) */ |
329 | #define REG_DOMAIN_ISRAEL 0x50 //Channel 3-9 ISRAEL | 329 | #define REG_DOMAIN_ISRAEL 0x50 /* Channel 3-9 ISRAEL */ |
330 | 330 | ||
331 | #define BSS_TYPE_AD_HOC 1 | 331 | #define BSS_TYPE_AD_HOC 1 |
332 | #define BSS_TYPE_INFRASTRUCTURE 2 | 332 | #define BSS_TYPE_INFRASTRUCTURE 2 |
@@ -364,13 +364,13 @@ struct tx_desc { | |||
364 | #define CIPHER_SUITE_CCX 4 | 364 | #define CIPHER_SUITE_CCX 4 |
365 | #define CIPHER_SUITE_WEP_128 5 | 365 | #define CIPHER_SUITE_WEP_128 5 |
366 | 366 | ||
367 | // | 367 | /* |
368 | // IFACE MACROS & definitions | 368 | * IFACE MACROS & definitions |
369 | // | 369 | */ |
370 | // | ||
371 | 370 | ||
372 | // FuncCtrl field: | 371 | /* |
373 | // | 372 | * FuncCtrl field: |
373 | */ | ||
374 | #define FUNC_CTRL_TxENABLE 0x10 | 374 | #define FUNC_CTRL_TxENABLE 0x10 |
375 | #define FUNC_CTRL_RxENABLE 0x20 | 375 | #define FUNC_CTRL_RxENABLE 0x20 |
376 | #define FUNC_CTRL_INIT_COMPLETE 0x01 | 376 | #define FUNC_CTRL_INIT_COMPLETE 0x01 |
@@ -378,48 +378,48 @@ struct tx_desc { | |||
378 | /* A stub firmware image which reads the MAC address from NVRAM on the card. | 378 | /* A stub firmware image which reads the MAC address from NVRAM on the card. |
379 | For copyright information and source see the end of this file. */ | 379 | For copyright information and source see the end of this file. */ |
380 | static u8 mac_reader[] = { | 380 | static u8 mac_reader[] = { |
381 | 0x06,0x00,0x00,0xea,0x04,0x00,0x00,0xea,0x03,0x00,0x00,0xea,0x02,0x00,0x00,0xea, | 381 | 0x06, 0x00, 0x00, 0xea, 0x04, 0x00, 0x00, 0xea, 0x03, 0x00, 0x00, 0xea, 0x02, 0x00, 0x00, 0xea, |
382 | 0x01,0x00,0x00,0xea,0x00,0x00,0x00,0xea,0xff,0xff,0xff,0xea,0xfe,0xff,0xff,0xea, | 382 | 0x01, 0x00, 0x00, 0xea, 0x00, 0x00, 0x00, 0xea, 0xff, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, |
383 | 0xd3,0x00,0xa0,0xe3,0x00,0xf0,0x21,0xe1,0x0e,0x04,0xa0,0xe3,0x00,0x10,0xa0,0xe3, | 383 | 0xd3, 0x00, 0xa0, 0xe3, 0x00, 0xf0, 0x21, 0xe1, 0x0e, 0x04, 0xa0, 0xe3, 0x00, 0x10, 0xa0, 0xe3, |
384 | 0x81,0x11,0xa0,0xe1,0x00,0x10,0x81,0xe3,0x00,0x10,0x80,0xe5,0x1c,0x10,0x90,0xe5, | 384 | 0x81, 0x11, 0xa0, 0xe1, 0x00, 0x10, 0x81, 0xe3, 0x00, 0x10, 0x80, 0xe5, 0x1c, 0x10, 0x90, 0xe5, |
385 | 0x10,0x10,0xc1,0xe3,0x1c,0x10,0x80,0xe5,0x01,0x10,0xa0,0xe3,0x08,0x10,0x80,0xe5, | 385 | 0x10, 0x10, 0xc1, 0xe3, 0x1c, 0x10, 0x80, 0xe5, 0x01, 0x10, 0xa0, 0xe3, 0x08, 0x10, 0x80, 0xe5, |
386 | 0x02,0x03,0xa0,0xe3,0x00,0x10,0xa0,0xe3,0xb0,0x10,0xc0,0xe1,0xb4,0x10,0xc0,0xe1, | 386 | 0x02, 0x03, 0xa0, 0xe3, 0x00, 0x10, 0xa0, 0xe3, 0xb0, 0x10, 0xc0, 0xe1, 0xb4, 0x10, 0xc0, 0xe1, |
387 | 0xb8,0x10,0xc0,0xe1,0xbc,0x10,0xc0,0xe1,0x56,0xdc,0xa0,0xe3,0x21,0x00,0x00,0xeb, | 387 | 0xb8, 0x10, 0xc0, 0xe1, 0xbc, 0x10, 0xc0, 0xe1, 0x56, 0xdc, 0xa0, 0xe3, 0x21, 0x00, 0x00, 0xeb, |
388 | 0x0a,0x00,0xa0,0xe3,0x1a,0x00,0x00,0xeb,0x10,0x00,0x00,0xeb,0x07,0x00,0x00,0xeb, | 388 | 0x0a, 0x00, 0xa0, 0xe3, 0x1a, 0x00, 0x00, 0xeb, 0x10, 0x00, 0x00, 0xeb, 0x07, 0x00, 0x00, 0xeb, |
389 | 0x02,0x03,0xa0,0xe3,0x02,0x14,0xa0,0xe3,0xb4,0x10,0xc0,0xe1,0x4c,0x10,0x9f,0xe5, | 389 | 0x02, 0x03, 0xa0, 0xe3, 0x02, 0x14, 0xa0, 0xe3, 0xb4, 0x10, 0xc0, 0xe1, 0x4c, 0x10, 0x9f, 0xe5, |
390 | 0xbc,0x10,0xc0,0xe1,0x10,0x10,0xa0,0xe3,0xb8,0x10,0xc0,0xe1,0xfe,0xff,0xff,0xea, | 390 | 0xbc, 0x10, 0xc0, 0xe1, 0x10, 0x10, 0xa0, 0xe3, 0xb8, 0x10, 0xc0, 0xe1, 0xfe, 0xff, 0xff, 0xea, |
391 | 0x00,0x40,0x2d,0xe9,0x00,0x20,0xa0,0xe3,0x02,0x3c,0xa0,0xe3,0x00,0x10,0xa0,0xe3, | 391 | 0x00, 0x40, 0x2d, 0xe9, 0x00, 0x20, 0xa0, 0xe3, 0x02, 0x3c, 0xa0, 0xe3, 0x00, 0x10, 0xa0, 0xe3, |
392 | 0x28,0x00,0x9f,0xe5,0x37,0x00,0x00,0xeb,0x00,0x40,0xbd,0xe8,0x1e,0xff,0x2f,0xe1, | 392 | 0x28, 0x00, 0x9f, 0xe5, 0x37, 0x00, 0x00, 0xeb, 0x00, 0x40, 0xbd, 0xe8, 0x1e, 0xff, 0x2f, 0xe1, |
393 | 0x00,0x40,0x2d,0xe9,0x12,0x2e,0xa0,0xe3,0x06,0x30,0xa0,0xe3,0x00,0x10,0xa0,0xe3, | 393 | 0x00, 0x40, 0x2d, 0xe9, 0x12, 0x2e, 0xa0, 0xe3, 0x06, 0x30, 0xa0, 0xe3, 0x00, 0x10, 0xa0, 0xe3, |
394 | 0x02,0x04,0xa0,0xe3,0x2f,0x00,0x00,0xeb,0x00,0x40,0xbd,0xe8,0x1e,0xff,0x2f,0xe1, | 394 | 0x02, 0x04, 0xa0, 0xe3, 0x2f, 0x00, 0x00, 0xeb, 0x00, 0x40, 0xbd, 0xe8, 0x1e, 0xff, 0x2f, 0xe1, |
395 | 0x00,0x02,0x00,0x02,0x80,0x01,0x90,0xe0,0x01,0x00,0x00,0x0a,0x01,0x00,0x50,0xe2, | 395 | 0x00, 0x02, 0x00, 0x02, 0x80, 0x01, 0x90, 0xe0, 0x01, 0x00, 0x00, 0x0a, 0x01, 0x00, 0x50, 0xe2, |
396 | 0xfc,0xff,0xff,0xea,0x1e,0xff,0x2f,0xe1,0x80,0x10,0xa0,0xe3,0xf3,0x06,0xa0,0xe3, | 396 | 0xfc, 0xff, 0xff, 0xea, 0x1e, 0xff, 0x2f, 0xe1, 0x80, 0x10, 0xa0, 0xe3, 0xf3, 0x06, 0xa0, 0xe3, |
397 | 0x00,0x10,0x80,0xe5,0x00,0x10,0xa0,0xe3,0x00,0x10,0x80,0xe5,0x01,0x10,0xa0,0xe3, | 397 | 0x00, 0x10, 0x80, 0xe5, 0x00, 0x10, 0xa0, 0xe3, 0x00, 0x10, 0x80, 0xe5, 0x01, 0x10, 0xa0, 0xe3, |
398 | 0x04,0x10,0x80,0xe5,0x00,0x10,0x80,0xe5,0x0e,0x34,0xa0,0xe3,0x1c,0x10,0x93,0xe5, | 398 | 0x04, 0x10, 0x80, 0xe5, 0x00, 0x10, 0x80, 0xe5, 0x0e, 0x34, 0xa0, 0xe3, 0x1c, 0x10, 0x93, 0xe5, |
399 | 0x02,0x1a,0x81,0xe3,0x1c,0x10,0x83,0xe5,0x58,0x11,0x9f,0xe5,0x30,0x10,0x80,0xe5, | 399 | 0x02, 0x1a, 0x81, 0xe3, 0x1c, 0x10, 0x83, 0xe5, 0x58, 0x11, 0x9f, 0xe5, 0x30, 0x10, 0x80, 0xe5, |
400 | 0x54,0x11,0x9f,0xe5,0x34,0x10,0x80,0xe5,0x38,0x10,0x80,0xe5,0x3c,0x10,0x80,0xe5, | 400 | 0x54, 0x11, 0x9f, 0xe5, 0x34, 0x10, 0x80, 0xe5, 0x38, 0x10, 0x80, 0xe5, 0x3c, 0x10, 0x80, 0xe5, |
401 | 0x10,0x10,0x90,0xe5,0x08,0x00,0x90,0xe5,0x1e,0xff,0x2f,0xe1,0xf3,0x16,0xa0,0xe3, | 401 | 0x10, 0x10, 0x90, 0xe5, 0x08, 0x00, 0x90, 0xe5, 0x1e, 0xff, 0x2f, 0xe1, 0xf3, 0x16, 0xa0, 0xe3, |
402 | 0x08,0x00,0x91,0xe5,0x05,0x00,0xa0,0xe3,0x0c,0x00,0x81,0xe5,0x10,0x00,0x91,0xe5, | 402 | 0x08, 0x00, 0x91, 0xe5, 0x05, 0x00, 0xa0, 0xe3, 0x0c, 0x00, 0x81, 0xe5, 0x10, 0x00, 0x91, 0xe5, |
403 | 0x02,0x00,0x10,0xe3,0xfc,0xff,0xff,0x0a,0xff,0x00,0xa0,0xe3,0x0c,0x00,0x81,0xe5, | 403 | 0x02, 0x00, 0x10, 0xe3, 0xfc, 0xff, 0xff, 0x0a, 0xff, 0x00, 0xa0, 0xe3, 0x0c, 0x00, 0x81, 0xe5, |
404 | 0x10,0x00,0x91,0xe5,0x02,0x00,0x10,0xe3,0xfc,0xff,0xff,0x0a,0x08,0x00,0x91,0xe5, | 404 | 0x10, 0x00, 0x91, 0xe5, 0x02, 0x00, 0x10, 0xe3, 0xfc, 0xff, 0xff, 0x0a, 0x08, 0x00, 0x91, 0xe5, |
405 | 0x10,0x00,0x91,0xe5,0x01,0x00,0x10,0xe3,0xfc,0xff,0xff,0x0a,0x08,0x00,0x91,0xe5, | 405 | 0x10, 0x00, 0x91, 0xe5, 0x01, 0x00, 0x10, 0xe3, 0xfc, 0xff, 0xff, 0x0a, 0x08, 0x00, 0x91, 0xe5, |
406 | 0xff,0x00,0x00,0xe2,0x1e,0xff,0x2f,0xe1,0x30,0x40,0x2d,0xe9,0x00,0x50,0xa0,0xe1, | 406 | 0xff, 0x00, 0x00, 0xe2, 0x1e, 0xff, 0x2f, 0xe1, 0x30, 0x40, 0x2d, 0xe9, 0x00, 0x50, 0xa0, 0xe1, |
407 | 0x03,0x40,0xa0,0xe1,0xa2,0x02,0xa0,0xe1,0x08,0x00,0x00,0xe2,0x03,0x00,0x80,0xe2, | 407 | 0x03, 0x40, 0xa0, 0xe1, 0xa2, 0x02, 0xa0, 0xe1, 0x08, 0x00, 0x00, 0xe2, 0x03, 0x00, 0x80, 0xe2, |
408 | 0xd8,0x10,0x9f,0xe5,0x00,0x00,0xc1,0xe5,0x01,0x20,0xc1,0xe5,0xe2,0xff,0xff,0xeb, | 408 | 0xd8, 0x10, 0x9f, 0xe5, 0x00, 0x00, 0xc1, 0xe5, 0x01, 0x20, 0xc1, 0xe5, 0xe2, 0xff, 0xff, 0xeb, |
409 | 0x01,0x00,0x10,0xe3,0xfc,0xff,0xff,0x1a,0x14,0x00,0xa0,0xe3,0xc4,0xff,0xff,0xeb, | 409 | 0x01, 0x00, 0x10, 0xe3, 0xfc, 0xff, 0xff, 0x1a, 0x14, 0x00, 0xa0, 0xe3, 0xc4, 0xff, 0xff, 0xeb, |
410 | 0x04,0x20,0xa0,0xe1,0x05,0x10,0xa0,0xe1,0x02,0x00,0xa0,0xe3,0x01,0x00,0x00,0xeb, | 410 | 0x04, 0x20, 0xa0, 0xe1, 0x05, 0x10, 0xa0, 0xe1, 0x02, 0x00, 0xa0, 0xe3, 0x01, 0x00, 0x00, 0xeb, |
411 | 0x30,0x40,0xbd,0xe8,0x1e,0xff,0x2f,0xe1,0x70,0x40,0x2d,0xe9,0xf3,0x46,0xa0,0xe3, | 411 | 0x30, 0x40, 0xbd, 0xe8, 0x1e, 0xff, 0x2f, 0xe1, 0x70, 0x40, 0x2d, 0xe9, 0xf3, 0x46, 0xa0, 0xe3, |
412 | 0x00,0x30,0xa0,0xe3,0x00,0x00,0x50,0xe3,0x08,0x00,0x00,0x9a,0x8c,0x50,0x9f,0xe5, | 412 | 0x00, 0x30, 0xa0, 0xe3, 0x00, 0x00, 0x50, 0xe3, 0x08, 0x00, 0x00, 0x9a, 0x8c, 0x50, 0x9f, 0xe5, |
413 | 0x03,0x60,0xd5,0xe7,0x0c,0x60,0x84,0xe5,0x10,0x60,0x94,0xe5,0x02,0x00,0x16,0xe3, | 413 | 0x03, 0x60, 0xd5, 0xe7, 0x0c, 0x60, 0x84, 0xe5, 0x10, 0x60, 0x94, 0xe5, 0x02, 0x00, 0x16, 0xe3, |
414 | 0xfc,0xff,0xff,0x0a,0x01,0x30,0x83,0xe2,0x00,0x00,0x53,0xe1,0xf7,0xff,0xff,0x3a, | 414 | 0xfc, 0xff, 0xff, 0x0a, 0x01, 0x30, 0x83, 0xe2, 0x00, 0x00, 0x53, 0xe1, 0xf7, 0xff, 0xff, 0x3a, |
415 | 0xff,0x30,0xa0,0xe3,0x0c,0x30,0x84,0xe5,0x08,0x00,0x94,0xe5,0x10,0x00,0x94,0xe5, | 415 | 0xff, 0x30, 0xa0, 0xe3, 0x0c, 0x30, 0x84, 0xe5, 0x08, 0x00, 0x94, 0xe5, 0x10, 0x00, 0x94, 0xe5, |
416 | 0x01,0x00,0x10,0xe3,0xfc,0xff,0xff,0x0a,0x08,0x00,0x94,0xe5,0x00,0x00,0xa0,0xe3, | 416 | 0x01, 0x00, 0x10, 0xe3, 0xfc, 0xff, 0xff, 0x0a, 0x08, 0x00, 0x94, 0xe5, 0x00, 0x00, 0xa0, 0xe3, |
417 | 0x00,0x00,0x52,0xe3,0x0b,0x00,0x00,0x9a,0x10,0x50,0x94,0xe5,0x02,0x00,0x15,0xe3, | 417 | 0x00, 0x00, 0x52, 0xe3, 0x0b, 0x00, 0x00, 0x9a, 0x10, 0x50, 0x94, 0xe5, 0x02, 0x00, 0x15, 0xe3, |
418 | 0xfc,0xff,0xff,0x0a,0x0c,0x30,0x84,0xe5,0x10,0x50,0x94,0xe5,0x01,0x00,0x15,0xe3, | 418 | 0xfc, 0xff, 0xff, 0x0a, 0x0c, 0x30, 0x84, 0xe5, 0x10, 0x50, 0x94, 0xe5, 0x01, 0x00, 0x15, 0xe3, |
419 | 0xfc,0xff,0xff,0x0a,0x08,0x50,0x94,0xe5,0x01,0x50,0xc1,0xe4,0x01,0x00,0x80,0xe2, | 419 | 0xfc, 0xff, 0xff, 0x0a, 0x08, 0x50, 0x94, 0xe5, 0x01, 0x50, 0xc1, 0xe4, 0x01, 0x00, 0x80, 0xe2, |
420 | 0x02,0x00,0x50,0xe1,0xf3,0xff,0xff,0x3a,0xc8,0x00,0xa0,0xe3,0x98,0xff,0xff,0xeb, | 420 | 0x02, 0x00, 0x50, 0xe1, 0xf3, 0xff, 0xff, 0x3a, 0xc8, 0x00, 0xa0, 0xe3, 0x98, 0xff, 0xff, 0xeb, |
421 | 0x70,0x40,0xbd,0xe8,0x1e,0xff,0x2f,0xe1,0x01,0x0c,0x00,0x02,0x01,0x02,0x00,0x02, | 421 | 0x70, 0x40, 0xbd, 0xe8, 0x1e, 0xff, 0x2f, 0xe1, 0x01, 0x0c, 0x00, 0x02, 0x01, 0x02, 0x00, 0x02, |
422 | 0x00,0x01,0x00,0x02 | 422 | 0x00, 0x01, 0x00, 0x02 |
423 | }; | 423 | }; |
424 | 424 | ||
425 | struct atmel_private { | 425 | struct atmel_private { |
@@ -433,7 +433,7 @@ struct atmel_private { | |||
433 | struct net_device *dev; | 433 | struct net_device *dev; |
434 | struct device *sys_dev; | 434 | struct device *sys_dev; |
435 | struct iw_statistics wstats; | 435 | struct iw_statistics wstats; |
436 | spinlock_t irqlock, timerlock; // spinlocks | 436 | spinlock_t irqlock, timerlock; /* spinlocks */ |
437 | enum { BUS_TYPE_PCCARD, BUS_TYPE_PCI } bus_type; | 437 | enum { BUS_TYPE_PCCARD, BUS_TYPE_PCI } bus_type; |
438 | enum { | 438 | enum { |
439 | CARD_TYPE_PARALLEL_FLASH, | 439 | CARD_TYPE_PARALLEL_FLASH, |
@@ -541,7 +541,7 @@ struct atmel_private { | |||
541 | u8 rx_buf[MAX_WIRELESS_BODY]; | 541 | u8 rx_buf[MAX_WIRELESS_BODY]; |
542 | }; | 542 | }; |
543 | 543 | ||
544 | static u8 atmel_basic_rates[4] = {0x82,0x84,0x0b,0x16}; | 544 | static u8 atmel_basic_rates[4] = {0x82, 0x84, 0x0b, 0x16}; |
545 | 545 | ||
546 | static const struct { | 546 | static const struct { |
547 | int reg_domain; | 547 | int reg_domain; |
@@ -1283,17 +1283,17 @@ static struct iw_statistics *atmel_get_wireless_stats(struct net_device *dev) | |||
1283 | 1283 | ||
1284 | static int atmel_change_mtu(struct net_device *dev, int new_mtu) | 1284 | static int atmel_change_mtu(struct net_device *dev, int new_mtu) |
1285 | { | 1285 | { |
1286 | if ((new_mtu < 68) || (new_mtu > 2312)) | 1286 | if ((new_mtu < 68) || (new_mtu > 2312)) |
1287 | return -EINVAL; | 1287 | return -EINVAL; |
1288 | dev->mtu = new_mtu; | 1288 | dev->mtu = new_mtu; |
1289 | return 0; | 1289 | return 0; |
1290 | } | 1290 | } |
1291 | 1291 | ||
1292 | static int atmel_set_mac_address(struct net_device *dev, void *p) | 1292 | static int atmel_set_mac_address(struct net_device *dev, void *p) |
1293 | { | 1293 | { |
1294 | struct sockaddr *addr = p; | 1294 | struct sockaddr *addr = p; |
1295 | 1295 | ||
1296 | memcpy (dev->dev_addr, addr->sa_data, dev->addr_len); | 1296 | memcpy (dev->dev_addr, addr->sa_data, dev->addr_len); |
1297 | return atmel_open(dev); | 1297 | return atmel_open(dev); |
1298 | } | 1298 | } |
1299 | 1299 | ||
@@ -1420,10 +1420,17 @@ static int atmel_proc_output (char *buf, struct atmel_private *priv) | |||
1420 | priv->firmware_id); | 1420 | priv->firmware_id); |
1421 | 1421 | ||
1422 | switch (priv->card_type) { | 1422 | switch (priv->card_type) { |
1423 | case CARD_TYPE_PARALLEL_FLASH: c = "Parallel flash"; break; | 1423 | case CARD_TYPE_PARALLEL_FLASH: |
1424 | case CARD_TYPE_SPI_FLASH: c = "SPI flash\n"; break; | 1424 | c = "Parallel flash"; |
1425 | case CARD_TYPE_EEPROM: c = "EEPROM"; break; | 1425 | break; |
1426 | default: c = "<unknown>"; | 1426 | case CARD_TYPE_SPI_FLASH: |
1427 | c = "SPI flash\n"; | ||
1428 | break; | ||
1429 | case CARD_TYPE_EEPROM: | ||
1430 | c = "EEPROM"; | ||
1431 | break; | ||
1432 | default: | ||
1433 | c = "<unknown>"; | ||
1427 | } | 1434 | } |
1428 | 1435 | ||
1429 | r = "<unknown>"; | 1436 | r = "<unknown>"; |
@@ -1439,16 +1446,33 @@ static int atmel_proc_output (char *buf, struct atmel_private *priv) | |||
1439 | priv->use_wpa ? "Yes" : "No"); | 1446 | priv->use_wpa ? "Yes" : "No"); |
1440 | } | 1447 | } |
1441 | 1448 | ||
1442 | switch(priv->station_state) { | 1449 | switch (priv->station_state) { |
1443 | case STATION_STATE_SCANNING: s = "Scanning"; break; | 1450 | case STATION_STATE_SCANNING: |
1444 | case STATION_STATE_JOINNING: s = "Joining"; break; | 1451 | s = "Scanning"; |
1445 | case STATION_STATE_AUTHENTICATING: s = "Authenticating"; break; | 1452 | break; |
1446 | case STATION_STATE_ASSOCIATING: s = "Associating"; break; | 1453 | case STATION_STATE_JOINNING: |
1447 | case STATION_STATE_READY: s = "Ready"; break; | 1454 | s = "Joining"; |
1448 | case STATION_STATE_REASSOCIATING: s = "Reassociating"; break; | 1455 | break; |
1449 | case STATION_STATE_MGMT_ERROR: s = "Management error"; break; | 1456 | case STATION_STATE_AUTHENTICATING: |
1450 | case STATION_STATE_DOWN: s = "Down"; break; | 1457 | s = "Authenticating"; |
1451 | default: s = "<unknown>"; | 1458 | break; |
1459 | case STATION_STATE_ASSOCIATING: | ||
1460 | s = "Associating"; | ||
1461 | break; | ||
1462 | case STATION_STATE_READY: | ||
1463 | s = "Ready"; | ||
1464 | break; | ||
1465 | case STATION_STATE_REASSOCIATING: | ||
1466 | s = "Reassociating"; | ||
1467 | break; | ||
1468 | case STATION_STATE_MGMT_ERROR: | ||
1469 | s = "Management error"; | ||
1470 | break; | ||
1471 | case STATION_STATE_DOWN: | ||
1472 | s = "Down"; | ||
1473 | break; | ||
1474 | default: | ||
1475 | s = "<unknown>"; | ||
1452 | } | 1476 | } |
1453 | 1477 | ||
1454 | p += sprintf(p, "Current state:\t\t%s\n", s); | 1478 | p += sprintf(p, "Current state:\t\t%s\n", s); |
@@ -1458,14 +1482,17 @@ static int atmel_proc_output (char *buf, struct atmel_private *priv) | |||
1458 | static int atmel_read_proc(char *page, char **start, off_t off, | 1482 | static int atmel_read_proc(char *page, char **start, off_t off, |
1459 | int count, int *eof, void *data) | 1483 | int count, int *eof, void *data) |
1460 | { | 1484 | { |
1461 | struct atmel_private *priv = data; | 1485 | struct atmel_private *priv = data; |
1462 | int len = atmel_proc_output (page, priv); | 1486 | int len = atmel_proc_output (page, priv); |
1463 | if (len <= off+count) *eof = 1; | 1487 | if (len <= off+count) |
1464 | *start = page + off; | 1488 | *eof = 1; |
1465 | len -= off; | 1489 | *start = page + off; |
1466 | if (len>count) len = count; | 1490 | len -= off; |
1467 | if (len<0) len = 0; | 1491 | if (len > count) |
1468 | return len; | 1492 | len = count; |
1493 | if (len < 0) | ||
1494 | len = 0; | ||
1495 | return len; | ||
1469 | } | 1496 | } |
1470 | 1497 | ||
1471 | struct net_device *init_atmel_card(unsigned short irq, unsigned long port, | 1498 | struct net_device *init_atmel_card(unsigned short irq, unsigned long port, |
@@ -1479,11 +1506,11 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port, | |||
1479 | int rc; | 1506 | int rc; |
1480 | 1507 | ||
1481 | /* Create the network device object. */ | 1508 | /* Create the network device object. */ |
1482 | dev = alloc_etherdev(sizeof(*priv)); | 1509 | dev = alloc_etherdev(sizeof(*priv)); |
1483 | if (!dev) { | 1510 | if (!dev) { |
1484 | printk(KERN_ERR "atmel: Couldn't alloc_etherdev\n"); | 1511 | printk(KERN_ERR "atmel: Couldn't alloc_etherdev\n"); |
1485 | return NULL; | 1512 | return NULL; |
1486 | } | 1513 | } |
1487 | if (dev_alloc_name(dev, dev->name) < 0) { | 1514 | if (dev_alloc_name(dev, dev->name) < 0) { |
1488 | printk(KERN_ERR "atmel: Couldn't get name!\n"); | 1515 | printk(KERN_ERR "atmel: Couldn't get name!\n"); |
1489 | goto err_out_free; | 1516 | goto err_out_free; |
@@ -1577,7 +1604,7 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port, | |||
1577 | if (register_netdev(dev)) | 1604 | if (register_netdev(dev)) |
1578 | goto err_out_res; | 1605 | goto err_out_res; |
1579 | 1606 | ||
1580 | if (!probe_atmel_card(dev)){ | 1607 | if (!probe_atmel_card(dev)) { |
1581 | unregister_netdev(dev); | 1608 | unregister_netdev(dev); |
1582 | goto err_out_res; | 1609 | goto err_out_res; |
1583 | } | 1610 | } |
@@ -1594,7 +1621,7 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port, | |||
1594 | return dev; | 1621 | return dev; |
1595 | 1622 | ||
1596 | err_out_res: | 1623 | err_out_res: |
1597 | release_region( dev->base_addr, 32); | 1624 | release_region(dev->base_addr, 32); |
1598 | err_out_irq: | 1625 | err_out_irq: |
1599 | free_irq(dev->irq, dev); | 1626 | free_irq(dev->irq, dev); |
1600 | err_out_free: | 1627 | err_out_free: |
@@ -1632,7 +1659,7 @@ static int atmel_set_essid(struct net_device *dev, | |||
1632 | struct atmel_private *priv = netdev_priv(dev); | 1659 | struct atmel_private *priv = netdev_priv(dev); |
1633 | 1660 | ||
1634 | /* Check if we asked for `any' */ | 1661 | /* Check if we asked for `any' */ |
1635 | if(dwrq->flags == 0) { | 1662 | if (dwrq->flags == 0) { |
1636 | priv->connect_to_any_BSS = 1; | 1663 | priv->connect_to_any_BSS = 1; |
1637 | } else { | 1664 | } else { |
1638 | int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; | 1665 | int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; |
@@ -1768,7 +1795,7 @@ static int atmel_set_encode(struct net_device *dev, | |||
1768 | } | 1795 | } |
1769 | if (dwrq->flags & IW_ENCODE_RESTRICTED) | 1796 | if (dwrq->flags & IW_ENCODE_RESTRICTED) |
1770 | priv->exclude_unencrypted = 1; | 1797 | priv->exclude_unencrypted = 1; |
1771 | if(dwrq->flags & IW_ENCODE_OPEN) | 1798 | if (dwrq->flags & IW_ENCODE_OPEN) |
1772 | priv->exclude_unencrypted = 0; | 1799 | priv->exclude_unencrypted = 0; |
1773 | 1800 | ||
1774 | return -EINPROGRESS; /* Call commit handler */ | 1801 | return -EINPROGRESS; /* Call commit handler */ |
@@ -1797,7 +1824,7 @@ static int atmel_get_encode(struct net_device *dev, | |||
1797 | /* Copy the key to the user buffer */ | 1824 | /* Copy the key to the user buffer */ |
1798 | dwrq->length = priv->wep_key_len[index]; | 1825 | dwrq->length = priv->wep_key_len[index]; |
1799 | if (dwrq->length > 16) { | 1826 | if (dwrq->length > 16) { |
1800 | dwrq->length=0; | 1827 | dwrq->length = 0; |
1801 | } else { | 1828 | } else { |
1802 | memset(extra, 0, 16); | 1829 | memset(extra, 0, 16); |
1803 | memcpy(extra, priv->wep_keys[index], dwrq->length); | 1830 | memcpy(extra, priv->wep_keys[index], dwrq->length); |
@@ -2013,11 +2040,20 @@ static int atmel_set_rate(struct net_device *dev, | |||
2013 | } else { | 2040 | } else { |
2014 | /* Setting by frequency value */ | 2041 | /* Setting by frequency value */ |
2015 | switch (vwrq->value) { | 2042 | switch (vwrq->value) { |
2016 | case 1000000: priv->tx_rate = 0; break; | 2043 | case 1000000: |
2017 | case 2000000: priv->tx_rate = 1; break; | 2044 | priv->tx_rate = 0; |
2018 | case 5500000: priv->tx_rate = 2; break; | 2045 | break; |
2019 | case 11000000: priv->tx_rate = 3; break; | 2046 | case 2000000: |
2020 | default: return -EINVAL; | 2047 | priv->tx_rate = 1; |
2048 | break; | ||
2049 | case 5500000: | ||
2050 | priv->tx_rate = 2; | ||
2051 | break; | ||
2052 | case 11000000: | ||
2053 | priv->tx_rate = 3; | ||
2054 | break; | ||
2055 | default: | ||
2056 | return -EINVAL; | ||
2021 | } | 2057 | } |
2022 | } | 2058 | } |
2023 | } | 2059 | } |
@@ -2062,11 +2098,19 @@ static int atmel_get_rate(struct net_device *dev, | |||
2062 | vwrq->value = 11000000; | 2098 | vwrq->value = 11000000; |
2063 | } else { | 2099 | } else { |
2064 | vwrq->fixed = 1; | 2100 | vwrq->fixed = 1; |
2065 | switch(priv->tx_rate) { | 2101 | switch (priv->tx_rate) { |
2066 | case 0: vwrq->value = 1000000; break; | 2102 | case 0: |
2067 | case 1: vwrq->value = 2000000; break; | 2103 | vwrq->value = 1000000; |
2068 | case 2: vwrq->value = 5500000; break; | 2104 | break; |
2069 | case 3: vwrq->value = 11000000; break; | 2105 | case 1: |
2106 | vwrq->value = 2000000; | ||
2107 | break; | ||
2108 | case 2: | ||
2109 | vwrq->value = 5500000; | ||
2110 | break; | ||
2111 | case 3: | ||
2112 | vwrq->value = 11000000; | ||
2113 | break; | ||
2070 | } | 2114 | } |
2071 | } | 2115 | } |
2072 | return 0; | 2116 | return 0; |
@@ -2576,8 +2620,7 @@ static const struct iw_priv_args atmel_private_args[] = { | |||
2576 | }, | 2620 | }, |
2577 | }; | 2621 | }; |
2578 | 2622 | ||
2579 | static const struct iw_handler_def atmel_handler_def = | 2623 | static const struct iw_handler_def atmel_handler_def = { |
2580 | { | ||
2581 | .num_standard = ARRAY_SIZE(atmel_handler), | 2624 | .num_standard = ARRAY_SIZE(atmel_handler), |
2582 | .num_private = ARRAY_SIZE(atmel_private_handler), | 2625 | .num_private = ARRAY_SIZE(atmel_private_handler), |
2583 | .num_private_args = ARRAY_SIZE(atmel_private_args), | 2626 | .num_private_args = ARRAY_SIZE(atmel_private_args), |
@@ -2834,7 +2877,7 @@ static void send_authentication_request(struct atmel_private *priv, u16 system, | |||
2834 | 2877 | ||
2835 | if (priv->wep_is_on && priv->CurrentAuthentTransactionSeqNum != 1) | 2878 | if (priv->wep_is_on && priv->CurrentAuthentTransactionSeqNum != 1) |
2836 | /* no WEP for authentication frames with TrSeqNo 1 */ | 2879 | /* no WEP for authentication frames with TrSeqNo 1 */ |
2837 | header.frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); | 2880 | header.frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); |
2838 | 2881 | ||
2839 | auth.alg = cpu_to_le16(system); | 2882 | auth.alg = cpu_to_le16(system); |
2840 | 2883 | ||
@@ -2969,7 +3012,7 @@ static void store_bss_info(struct atmel_private *priv, | |||
2969 | if (memcmp(bss, priv->BSSinfo[i].BSSID, 6) == 0) | 3012 | if (memcmp(bss, priv->BSSinfo[i].BSSID, 6) == 0) |
2970 | index = i; | 3013 | index = i; |
2971 | 3014 | ||
2972 | /* If we process a probe and an entry from this BSS exists | 3015 | /* If we process a probe and an entry from this BSS exists |
2973 | we will update the BSS entry with the info from this BSS. | 3016 | we will update the BSS entry with the info from this BSS. |
2974 | If we process a beacon we will only update RSSI */ | 3017 | If we process a beacon we will only update RSSI */ |
2975 | 3018 | ||
@@ -2995,7 +3038,7 @@ static void store_bss_info(struct atmel_private *priv, | |||
2995 | if (capability & WLAN_CAPABILITY_IBSS) | 3038 | if (capability & WLAN_CAPABILITY_IBSS) |
2996 | priv->BSSinfo[index].BSStype = IW_MODE_ADHOC; | 3039 | priv->BSSinfo[index].BSStype = IW_MODE_ADHOC; |
2997 | else if (capability & WLAN_CAPABILITY_ESS) | 3040 | else if (capability & WLAN_CAPABILITY_ESS) |
2998 | priv->BSSinfo[index].BSStype =IW_MODE_INFRA; | 3041 | priv->BSSinfo[index].BSStype = IW_MODE_INFRA; |
2999 | 3042 | ||
3000 | priv->BSSinfo[index].preamble = capability & WLAN_CAPABILITY_SHORT_PREAMBLE ? | 3043 | priv->BSSinfo[index].preamble = capability & WLAN_CAPABILITY_SHORT_PREAMBLE ? |
3001 | SHORT_PREAMBLE : LONG_PREAMBLE; | 3044 | SHORT_PREAMBLE : LONG_PREAMBLE; |
@@ -3042,7 +3085,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) | |||
3042 | } | 3085 | } |
3043 | 3086 | ||
3044 | if (should_associate) { | 3087 | if (should_associate) { |
3045 | if(priv->station_was_associated) { | 3088 | if (priv->station_was_associated) { |
3046 | atmel_enter_state(priv, STATION_STATE_REASSOCIATING); | 3089 | atmel_enter_state(priv, STATION_STATE_REASSOCIATING); |
3047 | send_association_request(priv, 1); | 3090 | send_association_request(priv, 1); |
3048 | return; | 3091 | return; |
@@ -3063,8 +3106,8 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) | |||
3063 | priv->exclude_unencrypted = 1; | 3106 | priv->exclude_unencrypted = 1; |
3064 | send_authentication_request(priv, WLAN_AUTH_SHARED_KEY, NULL, 0); | 3107 | send_authentication_request(priv, WLAN_AUTH_SHARED_KEY, NULL, 0); |
3065 | return; | 3108 | return; |
3066 | } else if ( system == WLAN_AUTH_SHARED_KEY | 3109 | } else if (system == WLAN_AUTH_SHARED_KEY |
3067 | && priv->wep_is_on) { | 3110 | && priv->wep_is_on) { |
3068 | priv->CurrentAuthentTransactionSeqNum = 0x001; | 3111 | priv->CurrentAuthentTransactionSeqNum = 0x001; |
3069 | priv->exclude_unencrypted = 0; | 3112 | priv->exclude_unencrypted = 0; |
3070 | send_authentication_request(priv, WLAN_AUTH_OPEN, NULL, 0); | 3113 | send_authentication_request(priv, WLAN_AUTH_OPEN, NULL, 0); |
@@ -3252,11 +3295,11 @@ static void smooth_rssi(struct atmel_private *priv, u8 rssi) | |||
3252 | u8 max_rssi = 42; /* 502-rmfd-revd max by experiment, default for now */ | 3295 | u8 max_rssi = 42; /* 502-rmfd-revd max by experiment, default for now */ |
3253 | 3296 | ||
3254 | switch (priv->firmware_type) { | 3297 | switch (priv->firmware_type) { |
3255 | case ATMEL_FW_TYPE_502E: | 3298 | case ATMEL_FW_TYPE_502E: |
3256 | max_rssi = 63; /* 502-rmfd-reve max by experiment */ | 3299 | max_rssi = 63; /* 502-rmfd-reve max by experiment */ |
3257 | break; | 3300 | break; |
3258 | default: | 3301 | default: |
3259 | break; | 3302 | break; |
3260 | } | 3303 | } |
3261 | 3304 | ||
3262 | rssi = rssi * 100 / max_rssi; | 3305 | rssi = rssi * 100 / max_rssi; |
@@ -3473,8 +3516,7 @@ static void atmel_command_irq(struct atmel_private *priv) | |||
3473 | status == CMD_STATUS_IN_PROGRESS) | 3516 | status == CMD_STATUS_IN_PROGRESS) |
3474 | return; | 3517 | return; |
3475 | 3518 | ||
3476 | switch (command){ | 3519 | switch (command) { |
3477 | |||
3478 | case CMD_Start: | 3520 | case CMD_Start: |
3479 | if (status == CMD_STATUS_COMPLETE) { | 3521 | if (status == CMD_STATUS_COMPLETE) { |
3480 | priv->station_was_associated = priv->station_is_associated; | 3522 | priv->station_was_associated = priv->station_is_associated; |
@@ -3709,7 +3751,7 @@ static int probe_atmel_card(struct net_device *dev) | |||
3709 | 3751 | ||
3710 | if (rc) { | 3752 | if (rc) { |
3711 | if (dev->dev_addr[0] == 0xFF) { | 3753 | if (dev->dev_addr[0] == 0xFF) { |
3712 | u8 default_mac[] = {0x00,0x04, 0x25, 0x00, 0x00, 0x00}; | 3754 | u8 default_mac[] = {0x00, 0x04, 0x25, 0x00, 0x00, 0x00}; |
3713 | printk(KERN_ALERT "%s: *** Invalid MAC address. UPGRADE Firmware ****\n", dev->name); | 3755 | printk(KERN_ALERT "%s: *** Invalid MAC address. UPGRADE Firmware ****\n", dev->name); |
3714 | memcpy(dev->dev_addr, default_mac, 6); | 3756 | memcpy(dev->dev_addr, default_mac, 6); |
3715 | } | 3757 | } |
@@ -3803,7 +3845,7 @@ static void build_wpa_mib(struct atmel_private *priv) | |||
3803 | } else { | 3845 | } else { |
3804 | mib.group_key = i; | 3846 | mib.group_key = i; |
3805 | priv->group_cipher_suite = priv->pairwise_cipher_suite; | 3847 | priv->group_cipher_suite = priv->pairwise_cipher_suite; |
3806 | mib.cipher_default_key_value[i][MAX_ENCRYPTION_KEY_SIZE-1] = 1; | 3848 | mib.cipher_default_key_value[i][MAX_ENCRYPTION_KEY_SIZE-1] = 1; |
3807 | mib.cipher_default_key_value[i][MAX_ENCRYPTION_KEY_SIZE-2] = priv->group_cipher_suite; | 3849 | mib.cipher_default_key_value[i][MAX_ENCRYPTION_KEY_SIZE-2] = priv->group_cipher_suite; |
3808 | } | 3850 | } |
3809 | } | 3851 | } |
@@ -3913,7 +3955,7 @@ static int reset_atmel_card(struct net_device *dev) | |||
3913 | len = fw_entry->size; | 3955 | len = fw_entry->size; |
3914 | } | 3956 | } |
3915 | 3957 | ||
3916 | if (len <= 0x6000) { | 3958 | if (len <= 0x6000) { |
3917 | atmel_write16(priv->dev, BSR, BSS_IRAM); | 3959 | atmel_write16(priv->dev, BSR, BSS_IRAM); |
3918 | atmel_copy_to_card(priv->dev, 0, fw, len); | 3960 | atmel_copy_to_card(priv->dev, 0, fw, len); |
3919 | atmel_set_gcr(priv->dev, GCR_REMAP); | 3961 | atmel_set_gcr(priv->dev, GCR_REMAP); |
@@ -3942,7 +3984,7 @@ static int reset_atmel_card(struct net_device *dev) | |||
3942 | priv->use_wpa = (priv->host_info.major_version == 4); | 3984 | priv->use_wpa = (priv->host_info.major_version == 4); |
3943 | priv->radio_on_broken = (priv->host_info.major_version == 5); | 3985 | priv->radio_on_broken = (priv->host_info.major_version == 5); |
3944 | 3986 | ||
3945 | /* unmask all irq sources */ | 3987 | /* unmask all irq sources */ |
3946 | atmel_wmem8(priv, atmel_hi(priv, IFACE_INT_MASK_OFFSET), 0xff); | 3988 | atmel_wmem8(priv, atmel_hi(priv, IFACE_INT_MASK_OFFSET), 0xff); |
3947 | 3989 | ||
3948 | /* int Tx system and enable Tx */ | 3990 | /* int Tx system and enable Tx */ |
@@ -3975,7 +4017,7 @@ static int reset_atmel_card(struct net_device *dev) | |||
3975 | CMD_STATUS_REJECTED_RADIO_OFF) { | 4017 | CMD_STATUS_REJECTED_RADIO_OFF) { |
3976 | printk(KERN_INFO "%s: cannot turn the radio on.\n", | 4018 | printk(KERN_INFO "%s: cannot turn the radio on.\n", |
3977 | dev->name); | 4019 | dev->name); |
3978 | return -EIO; | 4020 | return -EIO; |
3979 | } | 4021 | } |
3980 | } | 4022 | } |
3981 | 4023 | ||
@@ -3999,8 +4041,7 @@ static int reset_atmel_card(struct net_device *dev) | |||
3999 | else | 4041 | else |
4000 | build_wep_mib(priv); | 4042 | build_wep_mib(priv); |
4001 | 4043 | ||
4002 | if (old_state == STATION_STATE_READY) | 4044 | if (old_state == STATION_STATE_READY) { |
4003 | { | ||
4004 | union iwreq_data wrqu; | 4045 | union iwreq_data wrqu; |
4005 | 4046 | ||
4006 | wrqu.data.length = 0; | 4047 | wrqu.data.length = 0; |
@@ -4277,24 +4318,24 @@ static void atmel_wmem32(struct atmel_private *priv, u16 pos, u32 data) | |||
4277 | .set NVRAM_LENGTH, 0x0200 | 4318 | .set NVRAM_LENGTH, 0x0200 |
4278 | .set MAC_ADDRESS_MIB, SRAM_BASE | 4319 | .set MAC_ADDRESS_MIB, SRAM_BASE |
4279 | .set MAC_ADDRESS_LENGTH, 6 | 4320 | .set MAC_ADDRESS_LENGTH, 6 |
4280 | .set MAC_BOOT_FLAG, 0x10 | 4321 | .set MAC_BOOT_FLAG, 0x10 |
4281 | .set MR1, 0 | 4322 | .set MR1, 0 |
4282 | .set MR2, 4 | 4323 | .set MR2, 4 |
4283 | .set MR3, 8 | 4324 | .set MR3, 8 |
4284 | .set MR4, 0xC | 4325 | .set MR4, 0xC |
4285 | RESET_VECTOR: | 4326 | RESET_VECTOR: |
4286 | b RESET_HANDLER | 4327 | b RESET_HANDLER |
4287 | UNDEF_VECTOR: | 4328 | UNDEF_VECTOR: |
4288 | b HALT1 | 4329 | b HALT1 |
4289 | SWI_VECTOR: | 4330 | SWI_VECTOR: |
4290 | b HALT1 | 4331 | b HALT1 |
4291 | IABORT_VECTOR: | 4332 | IABORT_VECTOR: |
4292 | b HALT1 | 4333 | b HALT1 |
4293 | DABORT_VECTOR: | 4334 | DABORT_VECTOR: |
4294 | RESERVED_VECTOR: | 4335 | RESERVED_VECTOR: |
4295 | b HALT1 | 4336 | b HALT1 |
4296 | IRQ_VECTOR: | 4337 | IRQ_VECTOR: |
4297 | b HALT1 | 4338 | b HALT1 |
4298 | FIQ_VECTOR: | 4339 | FIQ_VECTOR: |
4299 | b HALT1 | 4340 | b HALT1 |
4300 | HALT1: b HALT1 | 4341 | HALT1: b HALT1 |
@@ -4306,7 +4347,7 @@ RESET_HANDLER: | |||
4306 | ldr r0, =SPI_CGEN_BASE | 4347 | ldr r0, =SPI_CGEN_BASE |
4307 | mov r1, #0 | 4348 | mov r1, #0 |
4308 | mov r1, r1, lsl #3 | 4349 | mov r1, r1, lsl #3 |
4309 | orr r1,r1, #0 | 4350 | orr r1, r1, #0 |
4310 | str r1, [r0] | 4351 | str r1, [r0] |
4311 | ldr r1, [r0, #28] | 4352 | ldr r1, [r0, #28] |
4312 | bic r1, r1, #16 | 4353 | bic r1, r1, #16 |