diff options
Diffstat (limited to 'drivers/net/wireless/orinoco/hermes.h')
-rw-r--r-- | drivers/net/wireless/orinoco/hermes.h | 62 |
1 files changed, 40 insertions, 22 deletions
diff --git a/drivers/net/wireless/orinoco/hermes.h b/drivers/net/wireless/orinoco/hermes.h index 2dddbb597c4..9ca34e722b4 100644 --- a/drivers/net/wireless/orinoco/hermes.h +++ b/drivers/net/wireless/orinoco/hermes.h | |||
@@ -374,6 +374,37 @@ struct hermes_multicast { | |||
374 | /* Timeouts */ | 374 | /* Timeouts */ |
375 | #define HERMES_BAP_BUSY_TIMEOUT (10000) /* In iterations of ~1us */ | 375 | #define HERMES_BAP_BUSY_TIMEOUT (10000) /* In iterations of ~1us */ |
376 | 376 | ||
377 | struct hermes; | ||
378 | |||
379 | /* Functions to access hardware */ | ||
380 | struct hermes_ops { | ||
381 | int (*init)(struct hermes *hw); | ||
382 | int (*cmd_wait)(struct hermes *hw, u16 cmd, u16 parm0, | ||
383 | struct hermes_response *resp); | ||
384 | int (*init_cmd_wait)(struct hermes *hw, u16 cmd, | ||
385 | u16 parm0, u16 parm1, u16 parm2, | ||
386 | struct hermes_response *resp); | ||
387 | int (*allocate)(struct hermes *hw, u16 size, u16 *fid); | ||
388 | int (*read_ltv)(struct hermes *hw, int bap, u16 rid, unsigned buflen, | ||
389 | u16 *length, void *buf); | ||
390 | int (*write_ltv)(struct hermes *hw, int bap, u16 rid, | ||
391 | u16 length, const void *value); | ||
392 | int (*bap_pread)(struct hermes *hw, int bap, void *buf, int len, | ||
393 | u16 id, u16 offset); | ||
394 | int (*bap_pwrite)(struct hermes *hw, int bap, const void *buf, | ||
395 | int len, u16 id, u16 offset); | ||
396 | int (*read_pda)(struct hermes *hw, __le16 *pda, | ||
397 | u32 pda_addr, u16 pda_len); | ||
398 | int (*program_init)(struct hermes *hw, u32 entry_point); | ||
399 | int (*program_end)(struct hermes *hw); | ||
400 | int (*program)(struct hermes *hw, const char *buf, | ||
401 | u32 addr, u32 len); | ||
402 | void (*lock_irqsave)(spinlock_t *lock, unsigned long *flags); | ||
403 | void (*unlock_irqrestore)(spinlock_t *lock, unsigned long *flags); | ||
404 | void (*lock_irq)(spinlock_t *lock); | ||
405 | void (*unlock_irq)(spinlock_t *lock); | ||
406 | }; | ||
407 | |||
377 | /* Basic control structure */ | 408 | /* Basic control structure */ |
378 | typedef struct hermes { | 409 | typedef struct hermes { |
379 | void __iomem *iobase; | 410 | void __iomem *iobase; |
@@ -381,6 +412,9 @@ typedef struct hermes { | |||
381 | #define HERMES_16BIT_REGSPACING 0 | 412 | #define HERMES_16BIT_REGSPACING 0 |
382 | #define HERMES_32BIT_REGSPACING 1 | 413 | #define HERMES_32BIT_REGSPACING 1 |
383 | u16 inten; /* Which interrupts should be enabled? */ | 414 | u16 inten; /* Which interrupts should be enabled? */ |
415 | bool eeprom_pda; | ||
416 | const struct hermes_ops *ops; | ||
417 | void *priv; | ||
384 | } hermes_t; | 418 | } hermes_t; |
385 | 419 | ||
386 | /* Register access convenience macros */ | 420 | /* Register access convenience macros */ |
@@ -394,22 +428,6 @@ typedef struct hermes { | |||
394 | 428 | ||
395 | /* Function prototypes */ | 429 | /* Function prototypes */ |
396 | void hermes_struct_init(hermes_t *hw, void __iomem *address, int reg_spacing); | 430 | void hermes_struct_init(hermes_t *hw, void __iomem *address, int reg_spacing); |
397 | int hermes_init(hermes_t *hw); | ||
398 | int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0, | ||
399 | struct hermes_response *resp); | ||
400 | int hermes_doicmd_wait(hermes_t *hw, u16 cmd, | ||
401 | u16 parm0, u16 parm1, u16 parm2, | ||
402 | struct hermes_response *resp); | ||
403 | int hermes_allocate(hermes_t *hw, u16 size, u16 *fid); | ||
404 | |||
405 | int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len, | ||
406 | u16 id, u16 offset); | ||
407 | int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len, | ||
408 | u16 id, u16 offset); | ||
409 | int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned buflen, | ||
410 | u16 *length, void *buf); | ||
411 | int hermes_write_ltv(hermes_t *hw, int bap, u16 rid, | ||
412 | u16 length, const void *value); | ||
413 | 431 | ||
414 | /* Inline functions */ | 432 | /* Inline functions */ |
415 | 433 | ||
@@ -426,13 +444,13 @@ static inline void hermes_set_irqmask(hermes_t *hw, u16 events) | |||
426 | 444 | ||
427 | static inline int hermes_enable_port(hermes_t *hw, int port) | 445 | static inline int hermes_enable_port(hermes_t *hw, int port) |
428 | { | 446 | { |
429 | return hermes_docmd_wait(hw, HERMES_CMD_ENABLE | (port << 8), | 447 | return hw->ops->cmd_wait(hw, HERMES_CMD_ENABLE | (port << 8), |
430 | 0, NULL); | 448 | 0, NULL); |
431 | } | 449 | } |
432 | 450 | ||
433 | static inline int hermes_disable_port(hermes_t *hw, int port) | 451 | static inline int hermes_disable_port(hermes_t *hw, int port) |
434 | { | 452 | { |
435 | return hermes_docmd_wait(hw, HERMES_CMD_DISABLE | (port << 8), | 453 | return hw->ops->cmd_wait(hw, HERMES_CMD_DISABLE | (port << 8), |
436 | 0, NULL); | 454 | 0, NULL); |
437 | } | 455 | } |
438 | 456 | ||
@@ -440,7 +458,7 @@ static inline int hermes_disable_port(hermes_t *hw, int port) | |||
440 | * information frame in __orinoco_ev_info() */ | 458 | * information frame in __orinoco_ev_info() */ |
441 | static inline int hermes_inquire(hermes_t *hw, u16 rid) | 459 | static inline int hermes_inquire(hermes_t *hw, u16 rid) |
442 | { | 460 | { |
443 | return hermes_docmd_wait(hw, HERMES_CMD_INQUIRE, rid, NULL); | 461 | return hw->ops->cmd_wait(hw, HERMES_CMD_INQUIRE, rid, NULL); |
444 | } | 462 | } |
445 | 463 | ||
446 | #define HERMES_BYTES_TO_RECLEN(n) ((((n)+1)/2) + 1) | 464 | #define HERMES_BYTES_TO_RECLEN(n) ((((n)+1)/2) + 1) |
@@ -475,10 +493,10 @@ static inline void hermes_clear_words(struct hermes *hw, int off, | |||
475 | } | 493 | } |
476 | 494 | ||
477 | #define HERMES_READ_RECORD(hw, bap, rid, buf) \ | 495 | #define HERMES_READ_RECORD(hw, bap, rid, buf) \ |
478 | (hermes_read_ltv((hw), (bap), (rid), sizeof(*buf), NULL, (buf))) | 496 | (hw->ops->read_ltv((hw), (bap), (rid), sizeof(*buf), NULL, (buf))) |
479 | #define HERMES_WRITE_RECORD(hw, bap, rid, buf) \ | 497 | #define HERMES_WRITE_RECORD(hw, bap, rid, buf) \ |
480 | (hermes_write_ltv((hw), (bap), (rid), \ | 498 | (hw->ops->write_ltv((hw), (bap), (rid), \ |
481 | HERMES_BYTES_TO_RECLEN(sizeof(*buf)), (buf))) | 499 | HERMES_BYTES_TO_RECLEN(sizeof(*buf)), (buf))) |
482 | 500 | ||
483 | static inline int hermes_read_wordrec(hermes_t *hw, int bap, u16 rid, u16 *word) | 501 | static inline int hermes_read_wordrec(hermes_t *hw, int bap, u16 rid, u16 *word) |
484 | { | 502 | { |