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