diff options
Diffstat (limited to 'drivers/net/wireless/orinoco/hermes.h')
-rw-r--r-- | drivers/net/wireless/orinoco/hermes.h | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/drivers/net/wireless/orinoco/hermes.h b/drivers/net/wireless/orinoco/hermes.h index d9f18c11682..28a42448d32 100644 --- a/drivers/net/wireless/orinoco/hermes.h +++ b/drivers/net/wireless/orinoco/hermes.h | |||
@@ -28,7 +28,7 @@ | |||
28 | * | 28 | * |
29 | * As a module of low level hardware access routines, there is no | 29 | * As a module of low level hardware access routines, there is no |
30 | * locking. Users of this module should ensure that they serialize | 30 | * locking. Users of this module should ensure that they serialize |
31 | * access to the hermes_t structure, and to the hardware | 31 | * access to the hermes structure, and to the hardware |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <linux/if_ether.h> | 34 | #include <linux/if_ether.h> |
@@ -43,7 +43,7 @@ | |||
43 | #define HERMES_BAP_DATALEN_MAX (4096) | 43 | #define HERMES_BAP_DATALEN_MAX (4096) |
44 | #define HERMES_BAP_OFFSET_MAX (4096) | 44 | #define HERMES_BAP_OFFSET_MAX (4096) |
45 | #define HERMES_PORTID_MAX (7) | 45 | #define HERMES_PORTID_MAX (7) |
46 | #define HERMES_NUMPORTS_MAX (HERMES_PORTID_MAX+1) | 46 | #define HERMES_NUMPORTS_MAX (HERMES_PORTID_MAX + 1) |
47 | #define HERMES_PDR_LEN_MAX (260) /* in bytes, from EK */ | 47 | #define HERMES_PDR_LEN_MAX (260) /* in bytes, from EK */ |
48 | #define HERMES_PDA_RECS_MAX (200) /* a guess */ | 48 | #define HERMES_PDA_RECS_MAX (200) /* a guess */ |
49 | #define HERMES_PDA_LEN_MAX (1024) /* in bytes, from EK */ | 49 | #define HERMES_PDA_LEN_MAX (1024) /* in bytes, from EK */ |
@@ -148,7 +148,7 @@ | |||
148 | #define HERMES_CMD_WRITEMIF (0x0031) | 148 | #define HERMES_CMD_WRITEMIF (0x0031) |
149 | 149 | ||
150 | /*--- Debugging Commands -----------------------------*/ | 150 | /*--- Debugging Commands -----------------------------*/ |
151 | #define HERMES_CMD_TEST (0x0038) | 151 | #define HERMES_CMD_TEST (0x0038) |
152 | 152 | ||
153 | 153 | ||
154 | /* Test command arguments */ | 154 | /* Test command arguments */ |
@@ -178,8 +178,8 @@ | |||
178 | 178 | ||
179 | #define HERMES_DESCRIPTOR_OFFSET 0 | 179 | #define HERMES_DESCRIPTOR_OFFSET 0 |
180 | #define HERMES_802_11_OFFSET (14) | 180 | #define HERMES_802_11_OFFSET (14) |
181 | #define HERMES_802_3_OFFSET (14+32) | 181 | #define HERMES_802_3_OFFSET (14 + 32) |
182 | #define HERMES_802_2_OFFSET (14+32+14) | 182 | #define HERMES_802_2_OFFSET (14 + 32 + 14) |
183 | #define HERMES_TXCNTL2_OFFSET (HERMES_802_3_OFFSET - 2) | 183 | #define HERMES_TXCNTL2_OFFSET (HERMES_802_3_OFFSET - 2) |
184 | 184 | ||
185 | #define HERMES_RXSTAT_ERR (0x0003) | 185 | #define HERMES_RXSTAT_ERR (0x0003) |
@@ -406,7 +406,7 @@ struct hermes_ops { | |||
406 | }; | 406 | }; |
407 | 407 | ||
408 | /* Basic control structure */ | 408 | /* Basic control structure */ |
409 | typedef struct hermes { | 409 | struct hermes { |
410 | void __iomem *iobase; | 410 | void __iomem *iobase; |
411 | int reg_spacing; | 411 | int reg_spacing; |
412 | #define HERMES_16BIT_REGSPACING 0 | 412 | #define HERMES_16BIT_REGSPACING 0 |
@@ -415,7 +415,7 @@ typedef struct hermes { | |||
415 | bool eeprom_pda; | 415 | bool eeprom_pda; |
416 | const struct hermes_ops *ops; | 416 | const struct hermes_ops *ops; |
417 | void *priv; | 417 | void *priv; |
418 | } hermes_t; | 418 | }; |
419 | 419 | ||
420 | /* Register access convenience macros */ | 420 | /* Register access convenience macros */ |
421 | #define hermes_read_reg(hw, off) \ | 421 | #define hermes_read_reg(hw, off) \ |
@@ -427,28 +427,29 @@ typedef struct hermes { | |||
427 | hermes_write_reg((hw), HERMES_##name, (val)) | 427 | hermes_write_reg((hw), HERMES_##name, (val)) |
428 | 428 | ||
429 | /* Function prototypes */ | 429 | /* Function prototypes */ |
430 | void hermes_struct_init(hermes_t *hw, void __iomem *address, int reg_spacing); | 430 | void hermes_struct_init(struct hermes *hw, void __iomem *address, |
431 | int reg_spacing); | ||
431 | 432 | ||
432 | /* Inline functions */ | 433 | /* Inline functions */ |
433 | 434 | ||
434 | static inline int hermes_present(hermes_t *hw) | 435 | static inline int hermes_present(struct hermes *hw) |
435 | { | 436 | { |
436 | return hermes_read_regn(hw, SWSUPPORT0) == HERMES_MAGIC; | 437 | return hermes_read_regn(hw, SWSUPPORT0) == HERMES_MAGIC; |
437 | } | 438 | } |
438 | 439 | ||
439 | static inline void hermes_set_irqmask(hermes_t *hw, u16 events) | 440 | static inline void hermes_set_irqmask(struct hermes *hw, u16 events) |
440 | { | 441 | { |
441 | hw->inten = events; | 442 | hw->inten = events; |
442 | hermes_write_regn(hw, INTEN, events); | 443 | hermes_write_regn(hw, INTEN, events); |
443 | } | 444 | } |
444 | 445 | ||
445 | static inline int hermes_enable_port(hermes_t *hw, int port) | 446 | static inline int hermes_enable_port(struct hermes *hw, int port) |
446 | { | 447 | { |
447 | return hw->ops->cmd_wait(hw, HERMES_CMD_ENABLE | (port << 8), | 448 | return hw->ops->cmd_wait(hw, HERMES_CMD_ENABLE | (port << 8), |
448 | 0, NULL); | 449 | 0, NULL); |
449 | } | 450 | } |
450 | 451 | ||
451 | static inline int hermes_disable_port(hermes_t *hw, int port) | 452 | static inline int hermes_disable_port(struct hermes *hw, int port) |
452 | { | 453 | { |
453 | return hw->ops->cmd_wait(hw, HERMES_CMD_DISABLE | (port << 8), | 454 | return hw->ops->cmd_wait(hw, HERMES_CMD_DISABLE | (port << 8), |
454 | 0, NULL); | 455 | 0, NULL); |
@@ -456,13 +457,13 @@ static inline int hermes_disable_port(hermes_t *hw, int port) | |||
456 | 457 | ||
457 | /* Initiate an INQUIRE command (tallies or scan). The result will come as an | 458 | /* Initiate an INQUIRE command (tallies or scan). The result will come as an |
458 | * information frame in __orinoco_ev_info() */ | 459 | * information frame in __orinoco_ev_info() */ |
459 | static inline int hermes_inquire(hermes_t *hw, u16 rid) | 460 | static inline int hermes_inquire(struct hermes *hw, u16 rid) |
460 | { | 461 | { |
461 | return hw->ops->cmd_wait(hw, HERMES_CMD_INQUIRE, rid, NULL); | 462 | return hw->ops->cmd_wait(hw, HERMES_CMD_INQUIRE, rid, NULL); |
462 | } | 463 | } |
463 | 464 | ||
464 | #define HERMES_BYTES_TO_RECLEN(n) ((((n)+1)/2) + 1) | 465 | #define HERMES_BYTES_TO_RECLEN(n) ((((n) + 1) / 2) + 1) |
465 | #define HERMES_RECLEN_TO_BYTES(n) (((n)-1) * 2) | 466 | #define HERMES_RECLEN_TO_BYTES(n) (((n) - 1) * 2) |
466 | 467 | ||
467 | /* Note that for the next two, the count is in 16-bit words, not bytes */ | 468 | /* Note that for the next two, the count is in 16-bit words, not bytes */ |
468 | static inline void hermes_read_words(struct hermes *hw, int off, | 469 | static inline void hermes_read_words(struct hermes *hw, int off, |
@@ -498,7 +499,8 @@ static inline void hermes_clear_words(struct hermes *hw, int off, | |||
498 | (hw->ops->write_ltv((hw), (bap), (rid), \ | 499 | (hw->ops->write_ltv((hw), (bap), (rid), \ |
499 | HERMES_BYTES_TO_RECLEN(sizeof(*buf)), (buf))) | 500 | HERMES_BYTES_TO_RECLEN(sizeof(*buf)), (buf))) |
500 | 501 | ||
501 | static inline int hermes_read_wordrec(hermes_t *hw, int bap, u16 rid, u16 *word) | 502 | static inline int hermes_read_wordrec(struct hermes *hw, int bap, u16 rid, |
503 | u16 *word) | ||
502 | { | 504 | { |
503 | __le16 rec; | 505 | __le16 rec; |
504 | int err; | 506 | int err; |
@@ -508,7 +510,8 @@ static inline int hermes_read_wordrec(hermes_t *hw, int bap, u16 rid, u16 *word) | |||
508 | return err; | 510 | return err; |
509 | } | 511 | } |
510 | 512 | ||
511 | static inline int hermes_write_wordrec(hermes_t *hw, int bap, u16 rid, u16 word) | 513 | static inline int hermes_write_wordrec(struct hermes *hw, int bap, u16 rid, |
514 | u16 word) | ||
512 | { | 515 | { |
513 | __le16 rec = cpu_to_le16(word); | 516 | __le16 rec = cpu_to_le16(word); |
514 | return HERMES_WRITE_RECORD(hw, bap, rid, &rec); | 517 | return HERMES_WRITE_RECORD(hw, bap, rid, &rec); |