com20020.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * Linux ARCnet driver - COM20020 chipset support - function declarations
  3. *
  4. * Written 1997 by David Woodhouse.
  5. * Written 1994-1999 by Avery Pennarun.
  6. * Derived from skeleton.c by Donald Becker.
  7. *
  8. * Special thanks to Contemporary Controls, Inc. (www.ccontrols.com)
  9. * for sponsoring the further development of this driver.
  10. *
  11. * **********************
  12. *
  13. * The original copyright of skeleton.c was as follows:
  14. *
  15. * skeleton.c Written 1993 by Donald Becker.
  16. * Copyright 1993 United States Government as represented by the
  17. * Director, National Security Agency. This software may only be used
  18. * and distributed according to the terms of the GNU General Public License as
  19. * modified by SRC, incorporated herein by reference.
  20. *
  21. * **********************
  22. *
  23. * For more details, see drivers/net/arcnet.c
  24. *
  25. * **********************
  26. */
  27. #ifndef __COM20020_H
  28. #define __COM20020_H
  29. int com20020_check(struct net_device *dev);
  30. int com20020_found(struct net_device *dev, int shared);
  31. extern const struct net_device_ops com20020_netdev_ops;
  32. /* The number of low I/O ports used by the card. */
  33. #define ARCNET_TOTAL_SIZE 8
  34. /* various register addresses */
  35. #ifdef CONFIG_SA1100_CT6001
  36. #define BUS_ALIGN 2 /* 8 bit device on a 16 bit bus - needs padding */
  37. #else
  38. #define BUS_ALIGN 1
  39. #endif
  40. #define _INTMASK (ioaddr+BUS_ALIGN*0) /* writable */
  41. #define _STATUS (ioaddr+BUS_ALIGN*0) /* readable */
  42. #define _COMMAND (ioaddr+BUS_ALIGN*1) /* standard arcnet commands */
  43. #define _DIAGSTAT (ioaddr+BUS_ALIGN*1) /* diagnostic status register */
  44. #define _ADDR_HI (ioaddr+BUS_ALIGN*2) /* control registers for IO-mapped memory */
  45. #define _ADDR_LO (ioaddr+BUS_ALIGN*3)
  46. #define _MEMDATA (ioaddr+BUS_ALIGN*4) /* data port for IO-mapped memory */
  47. #define _SUBADR (ioaddr+BUS_ALIGN*5) /* the extended port _XREG refers to */
  48. #define _CONFIG (ioaddr+BUS_ALIGN*6) /* configuration register */
  49. #define _XREG (ioaddr+BUS_ALIGN*7) /* extra registers (indexed by _CONFIG
  50. or _SUBADR) */
  51. /* in the ADDR_HI register */
  52. #define RDDATAflag 0x80 /* next access is a read (not a write) */
  53. /* in the DIAGSTAT register */
  54. #define NEWNXTIDflag 0x02 /* ID to which token is passed has changed */
  55. /* in the CONFIG register */
  56. #define RESETcfg 0x80 /* put card in reset state */
  57. #define TXENcfg 0x20 /* enable TX */
  58. /* in SETUP register */
  59. #define PROMISCset 0x10 /* enable RCV_ALL */
  60. #define P1MODE 0x80 /* enable P1-MODE for Backplane */
  61. #define SLOWARB 0x01 /* enable Slow Arbitration for >=5Mbps */
  62. /* COM2002x */
  63. #define SUB_TENTATIVE 0 /* tentative node ID */
  64. #define SUB_NODE 1 /* node ID */
  65. #define SUB_SETUP1 2 /* various options */
  66. #define SUB_TEST 3 /* test/diag register */
  67. /* COM20022 only */
  68. #define SUB_SETUP2 4 /* sundry options */
  69. #define SUB_BUSCTL 5 /* bus control options */
  70. #define SUB_DMACOUNT 6 /* DMA count options */
  71. #define SET_SUBADR(x) do { \
  72. if ((x) < 4) \
  73. { \
  74. lp->config = (lp->config & ~0x03) | (x); \
  75. SETCONF; \
  76. } \
  77. else \
  78. { \
  79. outb(x, _SUBADR); \
  80. } \
  81. } while (0)
  82. #undef ARCRESET
  83. #undef ASTATUS
  84. #undef ACOMMAND
  85. #undef AINTMASK
  86. #define ARCRESET { outb(lp->config | 0x80, _CONFIG); \
  87. udelay(5); \
  88. outb(lp->config , _CONFIG); \
  89. }
  90. #define ARCRESET0 { outb(0x18 | 0x80, _CONFIG); \
  91. udelay(5); \
  92. outb(0x18 , _CONFIG); \
  93. }
  94. #define ASTATUS() inb(_STATUS)
  95. #define ADIAGSTATUS() inb(_DIAGSTAT)
  96. #define ACOMMAND(cmd) outb((cmd),_COMMAND)
  97. #define AINTMASK(msk) outb((msk),_INTMASK)
  98. #define SETCONF outb(lp->config, _CONFIG)
  99. #endif /* __COM20020_H */