diff options
Diffstat (limited to 'drivers/net/wireless/orinoco/hermes.h')
-rw-r--r-- | drivers/net/wireless/orinoco/hermes.h | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/drivers/net/wireless/orinoco/hermes.h b/drivers/net/wireless/orinoco/hermes.h index 8b13c8fef3dc..c78c442a02c8 100644 --- a/drivers/net/wireless/orinoco/hermes.h +++ b/drivers/net/wireless/orinoco/hermes.h | |||
@@ -15,7 +15,8 @@ | |||
15 | * Copyright (C) 2000, David Gibson, Linuxcare Australia. | 15 | * Copyright (C) 2000, David Gibson, Linuxcare Australia. |
16 | * (C) Copyright David Gibson, IBM Corp. 2001-2003. | 16 | * (C) Copyright David Gibson, IBM Corp. 2001-2003. |
17 | * | 17 | * |
18 | * Portions taken from hfa384x.h, Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | 18 | * Portions taken from hfa384x.h. |
19 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
19 | * | 20 | * |
20 | * This file distributed under the GPL, version 2. | 21 | * This file distributed under the GPL, version 2. |
21 | */ | 22 | */ |
@@ -31,7 +32,7 @@ | |||
31 | */ | 32 | */ |
32 | 33 | ||
33 | #include <linux/if_ether.h> | 34 | #include <linux/if_ether.h> |
34 | #include <asm/io.h> | 35 | #include <linux/io.h> |
35 | 36 | ||
36 | /* | 37 | /* |
37 | * Limits and constants | 38 | * Limits and constants |
@@ -203,7 +204,7 @@ struct hermes_tx_descriptor { | |||
203 | __le32 sw_support; | 204 | __le32 sw_support; |
204 | u8 retry_count; | 205 | u8 retry_count; |
205 | u8 tx_rate; | 206 | u8 tx_rate; |
206 | __le16 tx_control; | 207 | __le16 tx_control; |
207 | } __attribute__ ((packed)); | 208 | } __attribute__ ((packed)); |
208 | 209 | ||
209 | #define HERMES_TXSTAT_RETRYERR (0x0001) | 210 | #define HERMES_TXSTAT_RETRYERR (0x0001) |
@@ -298,7 +299,7 @@ struct symbol_scan_apinfo { | |||
298 | /* bits: 0-ess, 1-ibss, 4-privacy [wep] */ | 299 | /* bits: 0-ess, 1-ibss, 4-privacy [wep] */ |
299 | __le16 essid_len; /* ESSID length */ | 300 | __le16 essid_len; /* ESSID length */ |
300 | u8 essid[32]; /* ESSID of the network */ | 301 | u8 essid[32]; /* ESSID of the network */ |
301 | __le16 rates[5]; /* Bit rate supported */ | 302 | __le16 rates[5]; /* Bit rate supported */ |
302 | __le16 basic_rates; /* Basic rates bitmask */ | 303 | __le16 basic_rates; /* Basic rates bitmask */ |
303 | u8 unknown2[6]; /* Always FF:FF:FF:FF:00:00 */ | 304 | u8 unknown2[6]; /* Always FF:FF:FF:FF:00:00 */ |
304 | u8 unknown3[8]; /* Always 0, appeared in f/w 3.91-68 */ | 305 | u8 unknown3[8]; /* Always 0, appeared in f/w 3.91-68 */ |
@@ -344,14 +345,14 @@ struct agere_ext_scan_info { | |||
344 | u8 data[316]; | 345 | u8 data[316]; |
345 | } __attribute__ ((packed)); | 346 | } __attribute__ ((packed)); |
346 | 347 | ||
347 | #define HERMES_LINKSTATUS_NOT_CONNECTED (0x0000) | 348 | #define HERMES_LINKSTATUS_NOT_CONNECTED (0x0000) |
348 | #define HERMES_LINKSTATUS_CONNECTED (0x0001) | 349 | #define HERMES_LINKSTATUS_CONNECTED (0x0001) |
349 | #define HERMES_LINKSTATUS_DISCONNECTED (0x0002) | 350 | #define HERMES_LINKSTATUS_DISCONNECTED (0x0002) |
350 | #define HERMES_LINKSTATUS_AP_CHANGE (0x0003) | 351 | #define HERMES_LINKSTATUS_AP_CHANGE (0x0003) |
351 | #define HERMES_LINKSTATUS_AP_OUT_OF_RANGE (0x0004) | 352 | #define HERMES_LINKSTATUS_AP_OUT_OF_RANGE (0x0004) |
352 | #define HERMES_LINKSTATUS_AP_IN_RANGE (0x0005) | 353 | #define HERMES_LINKSTATUS_AP_IN_RANGE (0x0005) |
353 | #define HERMES_LINKSTATUS_ASSOC_FAILED (0x0006) | 354 | #define HERMES_LINKSTATUS_ASSOC_FAILED (0x0006) |
354 | 355 | ||
355 | struct hermes_linkstatus { | 356 | struct hermes_linkstatus { |
356 | __le16 linkstatus; /* Link status */ | 357 | __le16 linkstatus; /* Link status */ |
357 | } __attribute__ ((packed)); | 358 | } __attribute__ ((packed)); |
@@ -384,11 +385,12 @@ typedef struct hermes { | |||
384 | 385 | ||
385 | /* Register access convenience macros */ | 386 | /* Register access convenience macros */ |
386 | #define hermes_read_reg(hw, off) \ | 387 | #define hermes_read_reg(hw, off) \ |
387 | (ioread16((hw)->iobase + ( (off) << (hw)->reg_spacing ))) | 388 | (ioread16((hw)->iobase + ((off) << (hw)->reg_spacing))) |
388 | #define hermes_write_reg(hw, off, val) \ | 389 | #define hermes_write_reg(hw, off, val) \ |
389 | (iowrite16((val), (hw)->iobase + ((off) << (hw)->reg_spacing))) | 390 | (iowrite16((val), (hw)->iobase + ((off) << (hw)->reg_spacing))) |
390 | #define hermes_read_regn(hw, name) hermes_read_reg((hw), HERMES_##name) | 391 | #define hermes_read_regn(hw, name) hermes_read_reg((hw), HERMES_##name) |
391 | #define hermes_write_regn(hw, name, val) hermes_write_reg((hw), HERMES_##name, (val)) | 392 | #define hermes_write_regn(hw, name, val) \ |
393 | hermes_write_reg((hw), HERMES_##name, (val)) | ||
392 | 394 | ||
393 | /* Function prototypes */ | 395 | /* Function prototypes */ |
394 | void hermes_struct_init(hermes_t *hw, void __iomem *address, int reg_spacing); | 396 | void hermes_struct_init(hermes_t *hw, void __iomem *address, int reg_spacing); |
@@ -430,7 +432,7 @@ static inline int hermes_enable_port(hermes_t *hw, int port) | |||
430 | 432 | ||
431 | static inline int hermes_disable_port(hermes_t *hw, int port) | 433 | static inline int hermes_disable_port(hermes_t *hw, int port) |
432 | { | 434 | { |
433 | return hermes_docmd_wait(hw, HERMES_CMD_DISABLE | (port << 8), | 435 | return hermes_docmd_wait(hw, HERMES_CMD_DISABLE | (port << 8), |
434 | 0, NULL); | 436 | 0, NULL); |
435 | } | 437 | } |
436 | 438 | ||
@@ -441,11 +443,12 @@ static inline int hermes_inquire(hermes_t *hw, u16 rid) | |||
441 | return hermes_docmd_wait(hw, HERMES_CMD_INQUIRE, rid, NULL); | 443 | return hermes_docmd_wait(hw, HERMES_CMD_INQUIRE, rid, NULL); |
442 | } | 444 | } |
443 | 445 | ||
444 | #define HERMES_BYTES_TO_RECLEN(n) ( (((n)+1)/2) + 1 ) | 446 | #define HERMES_BYTES_TO_RECLEN(n) ((((n)+1)/2) + 1) |
445 | #define HERMES_RECLEN_TO_BYTES(n) ( ((n)-1) * 2 ) | 447 | #define HERMES_RECLEN_TO_BYTES(n) (((n)-1) * 2) |
446 | 448 | ||
447 | /* Note that for the next two, the count is in 16-bit words, not bytes */ | 449 | /* Note that for the next two, the count is in 16-bit words, not bytes */ |
448 | static inline void hermes_read_words(struct hermes *hw, int off, void *buf, unsigned count) | 450 | static inline void hermes_read_words(struct hermes *hw, int off, |
451 | void *buf, unsigned count) | ||
449 | { | 452 | { |
450 | off = off << hw->reg_spacing; | 453 | off = off << hw->reg_spacing; |
451 | ioread16_rep(hw->iobase + off, buf, count); | 454 | ioread16_rep(hw->iobase + off, buf, count); |
@@ -460,7 +463,8 @@ static inline void hermes_write_bytes(struct hermes *hw, int off, | |||
460 | iowrite8(buf[count - 1], hw->iobase + off); | 463 | iowrite8(buf[count - 1], hw->iobase + off); |
461 | } | 464 | } |
462 | 465 | ||
463 | static inline void hermes_clear_words(struct hermes *hw, int off, unsigned count) | 466 | static inline void hermes_clear_words(struct hermes *hw, int off, |
467 | unsigned count) | ||
464 | { | 468 | { |
465 | unsigned i; | 469 | unsigned i; |
466 | 470 | ||
@@ -471,9 +475,10 @@ static inline void hermes_clear_words(struct hermes *hw, int off, unsigned count | |||
471 | } | 475 | } |
472 | 476 | ||
473 | #define HERMES_READ_RECORD(hw, bap, rid, buf) \ | 477 | #define HERMES_READ_RECORD(hw, bap, rid, buf) \ |
474 | (hermes_read_ltv((hw),(bap),(rid), sizeof(*buf), NULL, (buf))) | 478 | (hermes_read_ltv((hw), (bap), (rid), sizeof(*buf), NULL, (buf))) |
475 | #define HERMES_WRITE_RECORD(hw, bap, rid, buf) \ | 479 | #define HERMES_WRITE_RECORD(hw, bap, rid, buf) \ |
476 | (hermes_write_ltv((hw),(bap),(rid),HERMES_BYTES_TO_RECLEN(sizeof(*buf)),(buf))) | 480 | (hermes_write_ltv((hw), (bap), (rid), \ |
481 | HERMES_BYTES_TO_RECLEN(sizeof(*buf)), (buf))) | ||
477 | 482 | ||
478 | static inline int hermes_read_wordrec(hermes_t *hw, int bap, u16 rid, u16 *word) | 483 | static inline int hermes_read_wordrec(hermes_t *hw, int bap, u16 rid, u16 *word) |
479 | { | 484 | { |