126c6d281SJoe Perches /* 226c6d281SJoe Perches * Linux ARCnet driver - COM20020 chipset support - function declarations 326c6d281SJoe Perches * 426c6d281SJoe Perches * Written 1997 by David Woodhouse. 526c6d281SJoe Perches * Written 1994-1999 by Avery Pennarun. 626c6d281SJoe Perches * Derived from skeleton.c by Donald Becker. 726c6d281SJoe Perches * 826c6d281SJoe Perches * Special thanks to Contemporary Controls, Inc. (www.ccontrols.com) 926c6d281SJoe Perches * for sponsoring the further development of this driver. 1026c6d281SJoe Perches * 1126c6d281SJoe Perches * ********************** 1226c6d281SJoe Perches * 1326c6d281SJoe Perches * The original copyright of skeleton.c was as follows: 1426c6d281SJoe Perches * 1526c6d281SJoe Perches * skeleton.c Written 1993 by Donald Becker. 1626c6d281SJoe Perches * Copyright 1993 United States Government as represented by the 1726c6d281SJoe Perches * Director, National Security Agency. This software may only be used 1826c6d281SJoe Perches * and distributed according to the terms of the GNU General Public License as 1926c6d281SJoe Perches * modified by SRC, incorporated herein by reference. 2026c6d281SJoe Perches * 2126c6d281SJoe Perches * ********************** 2226c6d281SJoe Perches * 2326c6d281SJoe Perches * For more details, see drivers/net/arcnet.c 2426c6d281SJoe Perches * 2526c6d281SJoe Perches * ********************** 2626c6d281SJoe Perches */ 2726c6d281SJoe Perches #ifndef __COM20020_H 2826c6d281SJoe Perches #define __COM20020_H 2926c6d281SJoe Perches 3026c6d281SJoe Perches int com20020_check(struct net_device *dev); 3126c6d281SJoe Perches int com20020_found(struct net_device *dev, int shared); 3226c6d281SJoe Perches extern const struct net_device_ops com20020_netdev_ops; 3326c6d281SJoe Perches 3426c6d281SJoe Perches /* The number of low I/O ports used by the card. */ 3526c6d281SJoe Perches #define ARCNET_TOTAL_SIZE 8 3626c6d281SJoe Perches 3726c6d281SJoe Perches #define PLX_PCI_MAX_CARDS 2 3826c6d281SJoe Perches 3926c6d281SJoe Perches struct com20020_pci_channel_map { 4026c6d281SJoe Perches u32 bar; 4126c6d281SJoe Perches u32 offset; 4226c6d281SJoe Perches u32 size; /* 0x00 - auto, e.g. length of entire bar */ 4326c6d281SJoe Perches }; 4426c6d281SJoe Perches 4526c6d281SJoe Perches struct com20020_pci_card_info { 4626c6d281SJoe Perches const char *name; 4726c6d281SJoe Perches int devcount; 4826c6d281SJoe Perches 4926c6d281SJoe Perches struct com20020_pci_channel_map chan_map_tbl[PLX_PCI_MAX_CARDS]; 5026c6d281SJoe Perches 5126c6d281SJoe Perches unsigned int flags; 5226c6d281SJoe Perches }; 5326c6d281SJoe Perches 5426c6d281SJoe Perches struct com20020_priv { 5526c6d281SJoe Perches struct com20020_pci_card_info *ci; 5626c6d281SJoe Perches struct list_head list_dev; 5726c6d281SJoe Perches }; 5826c6d281SJoe Perches 5926c6d281SJoe Perches struct com20020_dev { 6026c6d281SJoe Perches struct list_head list; 6126c6d281SJoe Perches struct net_device *dev; 6226c6d281SJoe Perches 6326c6d281SJoe Perches struct com20020_priv *pci_priv; 6426c6d281SJoe Perches int index; 6526c6d281SJoe Perches }; 6626c6d281SJoe Perches 670fec6513SJoe Perches #define COM20020_REG_W_INTMASK 0 /* writable */ 680fec6513SJoe Perches #define COM20020_REG_R_STATUS 0 /* readable */ 690fec6513SJoe Perches #define COM20020_REG_W_COMMAND 1 /* standard arcnet commands */ 700fec6513SJoe Perches #define COM20020_REG_R_DIAGSTAT 1 /* diagnostic status */ 710fec6513SJoe Perches #define COM20020_REG_W_ADDR_HI 2 /* control for IO-mapped memory */ 720fec6513SJoe Perches #define COM20020_REG_W_ADDR_LO 3 730fec6513SJoe Perches #define COM20020_REG_RW_MEMDATA 4 /* data port for IO-mapped memory */ 740fec6513SJoe Perches #define COM20020_REG_W_SUBADR 5 /* the extended port _XREG refers to */ 750fec6513SJoe Perches #define COM20020_REG_W_CONFIG 6 /* configuration */ 760fec6513SJoe Perches #define COM20020_REG_W_XREG 7 /* extra 770fec6513SJoe Perches * (indexed by _CONFIG or _SUBADDR) 780fec6513SJoe Perches */ 7926c6d281SJoe Perches 8026c6d281SJoe Perches /* in the ADDR_HI register */ 8126c6d281SJoe Perches #define RDDATAflag 0x80 /* next access is a read (not a write) */ 8226c6d281SJoe Perches 8326c6d281SJoe Perches /* in the DIAGSTAT register */ 8426c6d281SJoe Perches #define NEWNXTIDflag 0x02 /* ID to which token is passed has changed */ 8526c6d281SJoe Perches 8626c6d281SJoe Perches /* in the CONFIG register */ 8726c6d281SJoe Perches #define RESETcfg 0x80 /* put card in reset state */ 8826c6d281SJoe Perches #define TXENcfg 0x20 /* enable TX */ 8984286f19SMichael Grzeschik #define XTOcfg(x) ((x) << 3) /* extended timeout */ 9026c6d281SJoe Perches 9126c6d281SJoe Perches /* in SETUP register */ 9226c6d281SJoe Perches #define PROMISCset 0x10 /* enable RCV_ALL */ 9326c6d281SJoe Perches #define P1MODE 0x80 /* enable P1-MODE for Backplane */ 9426c6d281SJoe Perches #define SLOWARB 0x01 /* enable Slow Arbitration for >=5Mbps */ 9526c6d281SJoe Perches 9626c6d281SJoe Perches /* COM2002x */ 9726c6d281SJoe Perches #define SUB_TENTATIVE 0 /* tentative node ID */ 9826c6d281SJoe Perches #define SUB_NODE 1 /* node ID */ 9926c6d281SJoe Perches #define SUB_SETUP1 2 /* various options */ 10026c6d281SJoe Perches #define SUB_TEST 3 /* test/diag register */ 10126c6d281SJoe Perches 10226c6d281SJoe Perches /* COM20022 only */ 10326c6d281SJoe Perches #define SUB_SETUP2 4 /* sundry options */ 10426c6d281SJoe Perches #define SUB_BUSCTL 5 /* bus control options */ 10526c6d281SJoe Perches #define SUB_DMACOUNT 6 /* DMA count options */ 10626c6d281SJoe Perches 1070fec6513SJoe Perches static inline void com20020_set_subaddress(struct arcnet_local *lp, 1080fec6513SJoe Perches int ioaddr, int val) 1090fec6513SJoe Perches { 1100fec6513SJoe Perches if (val < 4) { 1110fec6513SJoe Perches lp->config = (lp->config & ~0x03) | val; 1120fec6513SJoe Perches arcnet_outb(lp->config, ioaddr, COM20020_REG_W_CONFIG); 1130fec6513SJoe Perches } else { 1140fec6513SJoe Perches arcnet_outb(val, ioaddr, COM20020_REG_W_SUBADR); 11526c6d281SJoe Perches } 11626c6d281SJoe Perches } 11726c6d281SJoe Perches 11826c6d281SJoe Perches #endif /* __COM20020_H */ 119