aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/hermes.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/hermes.h')
-rw-r--r--drivers/net/wireless/hermes.h43
1 files changed, 5 insertions, 38 deletions
diff --git a/drivers/net/wireless/hermes.h b/drivers/net/wireless/hermes.h
index 7644f72a9f4e..8e3f0e3edb58 100644
--- a/drivers/net/wireless/hermes.h
+++ b/drivers/net/wireless/hermes.h
@@ -328,16 +328,6 @@ struct hermes_multicast {
328 u8 addr[HERMES_MAX_MULTICAST][ETH_ALEN]; 328 u8 addr[HERMES_MAX_MULTICAST][ETH_ALEN];
329} __attribute__ ((packed)); 329} __attribute__ ((packed));
330 330
331// #define HERMES_DEBUG_BUFFER 1
332#define HERMES_DEBUG_BUFSIZE 4096
333struct hermes_debug_entry {
334 int bap;
335 u16 id, offset;
336 int cycles;
337};
338
339#ifdef __KERNEL__
340
341/* Timeouts */ 331/* Timeouts */
342#define HERMES_BAP_BUSY_TIMEOUT (10000) /* In iterations of ~1us */ 332#define HERMES_BAP_BUSY_TIMEOUT (10000) /* In iterations of ~1us */
343 333
@@ -347,14 +337,7 @@ typedef struct hermes {
347 int reg_spacing; 337 int reg_spacing;
348#define HERMES_16BIT_REGSPACING 0 338#define HERMES_16BIT_REGSPACING 0
349#define HERMES_32BIT_REGSPACING 1 339#define HERMES_32BIT_REGSPACING 1
350
351 u16 inten; /* Which interrupts should be enabled? */ 340 u16 inten; /* Which interrupts should be enabled? */
352
353#ifdef HERMES_DEBUG_BUFFER
354 struct hermes_debug_entry dbuf[HERMES_DEBUG_BUFSIZE];
355 unsigned long dbufp;
356 unsigned long profile[HERMES_BAP_BUSY_TIMEOUT+1];
357#endif
358} hermes_t; 341} hermes_t;
359 342
360/* Register access convenience macros */ 343/* Register access convenience macros */
@@ -376,8 +359,6 @@ int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len,
376 u16 id, u16 offset); 359 u16 id, u16 offset);
377int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len, 360int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len,
378 u16 id, u16 offset); 361 u16 id, u16 offset);
379int hermes_bap_pwrite_pad(hermes_t *hw, int bap, const void *buf,
380 unsigned data_len, int len, u16 id, u16 offset);
381int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned buflen, 362int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned buflen,
382 u16 *length, void *buf); 363 u16 *length, void *buf);
383int hermes_write_ltv(hermes_t *hw, int bap, u16 rid, 364int hermes_write_ltv(hermes_t *hw, int bap, u16 rid,
@@ -425,10 +406,13 @@ static inline void hermes_read_words(struct hermes *hw, int off, void *buf, unsi
425 ioread16_rep(hw->iobase + off, buf, count); 406 ioread16_rep(hw->iobase + off, buf, count);
426} 407}
427 408
428static inline void hermes_write_words(struct hermes *hw, int off, const void *buf, unsigned count) 409static inline void hermes_write_bytes(struct hermes *hw, int off,
410 const char *buf, unsigned count)
429{ 411{
430 off = off << hw->reg_spacing; 412 off = off << hw->reg_spacing;
431 iowrite16_rep(hw->iobase + off, buf, count); 413 iowrite16_rep(hw->iobase + off, buf, count >> 1);
414 if (unlikely(count & 1))
415 iowrite8(buf[count - 1], hw->iobase + off);
432} 416}
433 417
434static inline void hermes_clear_words(struct hermes *hw, int off, unsigned count) 418static inline void hermes_clear_words(struct hermes *hw, int off, unsigned count)
@@ -462,21 +446,4 @@ static inline int hermes_write_wordrec(hermes_t *hw, int bap, u16 rid, u16 word)
462 return HERMES_WRITE_RECORD(hw, bap, rid, &rec); 446 return HERMES_WRITE_RECORD(hw, bap, rid, &rec);
463} 447}
464 448
465#else /* ! __KERNEL__ */
466
467/* These are provided for the benefit of userspace drivers and testing programs
468 which use ioperm() or iopl() */
469
470#define hermes_read_reg(base, off) (inw((base) + (off)))
471#define hermes_write_reg(base, off, val) (outw((val), (base) + (off)))
472
473#define hermes_read_regn(base, name) (hermes_read_reg((base), HERMES_##name))
474#define hermes_write_regn(base, name, val) (hermes_write_reg((base), HERMES_##name, (val)))
475
476/* Note that for the next two, the count is in 16-bit words, not bytes */
477#define hermes_read_data(base, off, buf, count) (insw((base) + (off), (buf), (count)))
478#define hermes_write_data(base, off, buf, count) (outsw((base) + (off), (buf), (count)))
479
480#endif /* ! __KERNEL__ */
481
482#endif /* _HERMES_H */ 449#endif /* _HERMES_H */