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
298890624aSMichael Grzeschik #include <linux/leds.h>
3026c6d281SJoe Perches
3126c6d281SJoe Perches int com20020_check(struct net_device *dev);
3226c6d281SJoe Perches int com20020_found(struct net_device *dev, int shared);
3326c6d281SJoe Perches extern const struct net_device_ops com20020_netdev_ops;
3426c6d281SJoe Perches
3526c6d281SJoe Perches /* The number of low I/O ports used by the card. */
3626c6d281SJoe Perches #define ARCNET_TOTAL_SIZE 8
3726c6d281SJoe Perches
3826c6d281SJoe Perches #define PLX_PCI_MAX_CARDS 2
3926c6d281SJoe Perches
408890624aSMichael Grzeschik struct ledoffsets {
418890624aSMichael Grzeschik int green;
428890624aSMichael Grzeschik int red;
438890624aSMichael Grzeschik };
448890624aSMichael Grzeschik
4526c6d281SJoe Perches struct com20020_pci_channel_map {
4626c6d281SJoe Perches u32 bar;
4726c6d281SJoe Perches u32 offset;
4826c6d281SJoe Perches u32 size; /* 0x00 - auto, e.g. length of entire bar */
4926c6d281SJoe Perches };
5026c6d281SJoe Perches
5126c6d281SJoe Perches struct com20020_pci_card_info {
5226c6d281SJoe Perches const char *name;
5326c6d281SJoe Perches int devcount;
5426c6d281SJoe Perches
5526c6d281SJoe Perches struct com20020_pci_channel_map chan_map_tbl[PLX_PCI_MAX_CARDS];
565ef216c1SMichael Grzeschik struct com20020_pci_channel_map misc_map;
575ef216c1SMichael Grzeschik
588890624aSMichael Grzeschik struct ledoffsets leds[PLX_PCI_MAX_CARDS];
595ef216c1SMichael Grzeschik int rotary;
6026c6d281SJoe Perches
6126c6d281SJoe Perches unsigned int flags;
6226c6d281SJoe Perches };
6326c6d281SJoe Perches
6426c6d281SJoe Perches struct com20020_priv {
6526c6d281SJoe Perches struct com20020_pci_card_info *ci;
6626c6d281SJoe Perches struct list_head list_dev;
675ef216c1SMichael Grzeschik resource_size_t misc;
6826c6d281SJoe Perches };
6926c6d281SJoe Perches
7026c6d281SJoe Perches struct com20020_dev {
7126c6d281SJoe Perches struct list_head list;
7226c6d281SJoe Perches struct net_device *dev;
7326c6d281SJoe Perches
748890624aSMichael Grzeschik struct led_classdev tx_led;
758890624aSMichael Grzeschik struct led_classdev recon_led;
768890624aSMichael Grzeschik
7726c6d281SJoe Perches struct com20020_priv *pci_priv;
7826c6d281SJoe Perches int index;
7926c6d281SJoe Perches };
8026c6d281SJoe Perches
810fec6513SJoe Perches #define COM20020_REG_W_INTMASK 0 /* writable */
820fec6513SJoe Perches #define COM20020_REG_R_STATUS 0 /* readable */
830fec6513SJoe Perches #define COM20020_REG_W_COMMAND 1 /* standard arcnet commands */
840fec6513SJoe Perches #define COM20020_REG_R_DIAGSTAT 1 /* diagnostic status */
850fec6513SJoe Perches #define COM20020_REG_W_ADDR_HI 2 /* control for IO-mapped memory */
860fec6513SJoe Perches #define COM20020_REG_W_ADDR_LO 3
870fec6513SJoe Perches #define COM20020_REG_RW_MEMDATA 4 /* data port for IO-mapped memory */
880fec6513SJoe Perches #define COM20020_REG_W_SUBADR 5 /* the extended port _XREG refers to */
890fec6513SJoe Perches #define COM20020_REG_W_CONFIG 6 /* configuration */
900fec6513SJoe Perches #define COM20020_REG_W_XREG 7 /* extra
910fec6513SJoe Perches * (indexed by _CONFIG or _SUBADDR)
920fec6513SJoe Perches */
9326c6d281SJoe Perches
9426c6d281SJoe Perches /* in the ADDR_HI register */
9526c6d281SJoe Perches #define RDDATAflag 0x80 /* next access is a read (not a write) */
9626c6d281SJoe Perches
9726c6d281SJoe Perches /* in the DIAGSTAT register */
9826c6d281SJoe Perches #define NEWNXTIDflag 0x02 /* ID to which token is passed has changed */
9926c6d281SJoe Perches
10026c6d281SJoe Perches /* in the CONFIG register */
10126c6d281SJoe Perches #define RESETcfg 0x80 /* put card in reset state */
10226c6d281SJoe Perches #define TXENcfg 0x20 /* enable TX */
10384286f19SMichael Grzeschik #define XTOcfg(x) ((x) << 3) /* extended timeout */
10426c6d281SJoe Perches
10526c6d281SJoe Perches /* in SETUP register */
10626c6d281SJoe Perches #define PROMISCset 0x10 /* enable RCV_ALL */
10726c6d281SJoe Perches #define P1MODE 0x80 /* enable P1-MODE for Backplane */
10826c6d281SJoe Perches #define SLOWARB 0x01 /* enable Slow Arbitration for >=5Mbps */
10926c6d281SJoe Perches
11026c6d281SJoe Perches /* COM2002x */
11126c6d281SJoe Perches #define SUB_TENTATIVE 0 /* tentative node ID */
11226c6d281SJoe Perches #define SUB_NODE 1 /* node ID */
11326c6d281SJoe Perches #define SUB_SETUP1 2 /* various options */
11426c6d281SJoe Perches #define SUB_TEST 3 /* test/diag register */
11526c6d281SJoe Perches
11626c6d281SJoe Perches /* COM20022 only */
11726c6d281SJoe Perches #define SUB_SETUP2 4 /* sundry options */
11826c6d281SJoe Perches #define SUB_BUSCTL 5 /* bus control options */
11926c6d281SJoe Perches #define SUB_DMACOUNT 6 /* DMA count options */
12026c6d281SJoe Perches
com20020_set_subaddress(struct arcnet_local * lp,int ioaddr,int val)1210fec6513SJoe Perches static inline void com20020_set_subaddress(struct arcnet_local *lp,
1220fec6513SJoe Perches int ioaddr, int val)
1230fec6513SJoe Perches {
1240fec6513SJoe Perches if (val < 4) {
1250fec6513SJoe Perches lp->config = (lp->config & ~0x03) | val;
1260fec6513SJoe Perches arcnet_outb(lp->config, ioaddr, COM20020_REG_W_CONFIG);
1270fec6513SJoe Perches } else {
1280fec6513SJoe Perches arcnet_outb(val, ioaddr, COM20020_REG_W_SUBADR);
12926c6d281SJoe Perches }
13026c6d281SJoe Perches }
13126c6d281SJoe Perches
13226c6d281SJoe Perches #endif /* __COM20020_H */
133