com20020.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. #include <linux/leds.h>
  30. int com20020_check(struct net_device *dev);
  31. int com20020_found(struct net_device *dev, int shared);
  32. extern const struct net_device_ops com20020_netdev_ops;
  33. /* The number of low I/O ports used by the card. */
  34. #define ARCNET_TOTAL_SIZE 8
  35. #define PLX_PCI_MAX_CARDS 2
  36. struct ledoffsets {
  37. int green;
  38. int red;
  39. };
  40. struct com20020_pci_channel_map {
  41. u32 bar;
  42. u32 offset;
  43. u32 size; /* 0x00 - auto, e.g. length of entire bar */
  44. };
  45. struct com20020_pci_card_info {
  46. const char *name;
  47. int devcount;
  48. struct com20020_pci_channel_map chan_map_tbl[PLX_PCI_MAX_CARDS];
  49. struct com20020_pci_channel_map misc_map;
  50. struct ledoffsets leds[PLX_PCI_MAX_CARDS];
  51. int rotary;
  52. unsigned int flags;
  53. };
  54. struct com20020_priv {
  55. struct com20020_pci_card_info *ci;
  56. struct list_head list_dev;
  57. resource_size_t misc;
  58. };
  59. struct com20020_dev {
  60. struct list_head list;
  61. struct net_device *dev;
  62. struct led_classdev tx_led;
  63. struct led_classdev recon_led;
  64. struct com20020_priv *pci_priv;
  65. int index;
  66. };
  67. #define COM20020_REG_W_INTMASK 0 /* writable */
  68. #define COM20020_REG_R_STATUS 0 /* readable */
  69. #define COM20020_REG_W_COMMAND 1 /* standard arcnet commands */
  70. #define COM20020_REG_R_DIAGSTAT 1 /* diagnostic status */
  71. #define COM20020_REG_W_ADDR_HI 2 /* control for IO-mapped memory */
  72. #define COM20020_REG_W_ADDR_LO 3
  73. #define COM20020_REG_RW_MEMDATA 4 /* data port for IO-mapped memory */
  74. #define COM20020_REG_W_SUBADR 5 /* the extended port _XREG refers to */
  75. #define COM20020_REG_W_CONFIG 6 /* configuration */
  76. #define COM20020_REG_W_XREG 7 /* extra
  77. * (indexed by _CONFIG or _SUBADDR)
  78. */
  79. /* in the ADDR_HI register */
  80. #define RDDATAflag 0x80 /* next access is a read (not a write) */
  81. /* in the DIAGSTAT register */
  82. #define NEWNXTIDflag 0x02 /* ID to which token is passed has changed */
  83. /* in the CONFIG register */
  84. #define RESETcfg 0x80 /* put card in reset state */
  85. #define TXENcfg 0x20 /* enable TX */
  86. #define XTOcfg(x) ((x) << 3) /* extended timeout */
  87. /* in SETUP register */
  88. #define PROMISCset 0x10 /* enable RCV_ALL */
  89. #define P1MODE 0x80 /* enable P1-MODE for Backplane */
  90. #define SLOWARB 0x01 /* enable Slow Arbitration for >=5Mbps */
  91. /* COM2002x */
  92. #define SUB_TENTATIVE 0 /* tentative node ID */
  93. #define SUB_NODE 1 /* node ID */
  94. #define SUB_SETUP1 2 /* various options */
  95. #define SUB_TEST 3 /* test/diag register */
  96. /* COM20022 only */
  97. #define SUB_SETUP2 4 /* sundry options */
  98. #define SUB_BUSCTL 5 /* bus control options */
  99. #define SUB_DMACOUNT 6 /* DMA count options */
  100. static inline void com20020_set_subaddress(struct arcnet_local *lp,
  101. int ioaddr, int val)
  102. {
  103. if (val < 4) {
  104. lp->config = (lp->config & ~0x03) | val;
  105. arcnet_outb(lp->config, ioaddr, COM20020_REG_W_CONFIG);
  106. } else {
  107. arcnet_outb(val, ioaddr, COM20020_REG_W_SUBADR);
  108. }
  109. }
  110. #endif /* __COM20020_H */