Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Linux ARCnet driver - COM20020 chipset support - function declarations
0003  *
0004  * Written 1997 by David Woodhouse.
0005  * Written 1994-1999 by Avery Pennarun.
0006  * Derived from skeleton.c by Donald Becker.
0007  *
0008  * Special thanks to Contemporary Controls, Inc. (www.ccontrols.com)
0009  *  for sponsoring the further development of this driver.
0010  *
0011  * **********************
0012  *
0013  * The original copyright of skeleton.c was as follows:
0014  *
0015  * skeleton.c Written 1993 by Donald Becker.
0016  * Copyright 1993 United States Government as represented by the
0017  * Director, National Security Agency.  This software may only be used
0018  * and distributed according to the terms of the GNU General Public License as
0019  * modified by SRC, incorporated herein by reference.
0020  *
0021  * **********************
0022  *
0023  * For more details, see drivers/net/arcnet.c
0024  *
0025  * **********************
0026  */
0027 #ifndef __COM20020_H
0028 #define __COM20020_H
0029 #include <linux/leds.h>
0030 
0031 int com20020_check(struct net_device *dev);
0032 int com20020_found(struct net_device *dev, int shared);
0033 extern const struct net_device_ops com20020_netdev_ops;
0034 
0035 /* The number of low I/O ports used by the card. */
0036 #define ARCNET_TOTAL_SIZE 8
0037 
0038 #define PLX_PCI_MAX_CARDS 2
0039 
0040 struct ledoffsets {
0041     int green;
0042     int red;
0043 };
0044 
0045 struct com20020_pci_channel_map {
0046     u32 bar;
0047     u32 offset;
0048     u32 size;               /* 0x00 - auto, e.g. length of entire bar */
0049 };
0050 
0051 struct com20020_pci_card_info {
0052     const char *name;
0053     int devcount;
0054 
0055     struct com20020_pci_channel_map chan_map_tbl[PLX_PCI_MAX_CARDS];
0056     struct com20020_pci_channel_map misc_map;
0057 
0058     struct ledoffsets leds[PLX_PCI_MAX_CARDS];
0059     int rotary;
0060 
0061     unsigned int flags;
0062 };
0063 
0064 struct com20020_priv {
0065     struct com20020_pci_card_info *ci;
0066     struct list_head list_dev;
0067     resource_size_t misc;
0068 };
0069 
0070 struct com20020_dev {
0071     struct list_head list;
0072     struct net_device *dev;
0073 
0074     struct led_classdev tx_led;
0075     struct led_classdev recon_led;
0076 
0077     struct com20020_priv *pci_priv;
0078     int index;
0079 };
0080 
0081 #define COM20020_REG_W_INTMASK  0   /* writable */
0082 #define COM20020_REG_R_STATUS   0   /* readable */
0083 #define COM20020_REG_W_COMMAND  1   /* standard arcnet commands */
0084 #define COM20020_REG_R_DIAGSTAT 1   /* diagnostic status */
0085 #define COM20020_REG_W_ADDR_HI  2   /* control for IO-mapped memory */
0086 #define COM20020_REG_W_ADDR_LO  3
0087 #define COM20020_REG_RW_MEMDATA 4   /* data port for IO-mapped memory */
0088 #define COM20020_REG_W_SUBADR   5   /* the extended port _XREG refers to */
0089 #define COM20020_REG_W_CONFIG   6   /* configuration */
0090 #define COM20020_REG_W_XREG 7   /* extra
0091                      * (indexed by _CONFIG or _SUBADDR)
0092                      */
0093 
0094 /* in the ADDR_HI register */
0095 #define RDDATAflag  0x80    /* next access is a read (not a write) */
0096 
0097 /* in the DIAGSTAT register */
0098 #define NEWNXTIDflag    0x02    /* ID to which token is passed has changed */
0099 
0100 /* in the CONFIG register */
0101 #define RESETcfg    0x80    /* put card in reset state */
0102 #define TXENcfg     0x20    /* enable TX */
0103 #define XTOcfg(x)   ((x) << 3)  /* extended timeout */
0104 
0105 /* in SETUP register */
0106 #define PROMISCset  0x10    /* enable RCV_ALL */
0107 #define P1MODE      0x80    /* enable P1-MODE for Backplane */
0108 #define SLOWARB     0x01    /* enable Slow Arbitration for >=5Mbps */
0109 
0110 /* COM2002x */
0111 #define SUB_TENTATIVE   0   /* tentative node ID */
0112 #define SUB_NODE    1   /* node ID */
0113 #define SUB_SETUP1  2   /* various options */
0114 #define SUB_TEST    3   /* test/diag register */
0115 
0116 /* COM20022 only */
0117 #define SUB_SETUP2  4   /* sundry options */
0118 #define SUB_BUSCTL  5   /* bus control options */
0119 #define SUB_DMACOUNT    6   /* DMA count options */
0120 
0121 static inline void com20020_set_subaddress(struct arcnet_local *lp,
0122                        int ioaddr, int val)
0123 {
0124     if (val < 4) {
0125         lp->config = (lp->config & ~0x03) | val;
0126         arcnet_outb(lp->config, ioaddr, COM20020_REG_W_CONFIG);
0127     } else {
0128         arcnet_outb(val, ioaddr, COM20020_REG_W_SUBADR);
0129     }
0130 }
0131 
0132 #endif /* __COM20020_H */