]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - include/linux/com20020.h
ARCNET: add com20020 PCI IDs with metadata
[mirror_ubuntu-zesty-kernel.git] / include / linux / com20020.h
CommitLineData
1da177e4
LT
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
30int com20020_check(struct net_device *dev);
31int com20020_found(struct net_device *dev, int shared);
0db155de 32extern const struct net_device_ops com20020_netdev_ops;
1da177e4
LT
33
34/* The number of low I/O ports used by the card. */
35#define ARCNET_TOTAL_SIZE 8
36
37/* various register addresses */
38#ifdef CONFIG_SA1100_CT6001
39#define BUS_ALIGN 2 /* 8 bit device on a 16 bit bus - needs padding */
40#else
41#define BUS_ALIGN 1
42#endif
43
8c14f9c7
MG
44#define PLX_PCI_MAX_CARDS 1
45
46struct com20020_pci_channel_map {
47 u32 bar;
48 u32 offset;
49 u32 size; /* 0x00 - auto, e.g. length of entire bar */
50};
51
52struct com20020_pci_card_info {
53 const char *name;
54 int devcount;
55
56 struct com20020_pci_channel_map chan_map_tbl[PLX_PCI_MAX_CARDS];
57
58 unsigned int flags;
59};
1da177e4
LT
60
61#define _INTMASK (ioaddr+BUS_ALIGN*0) /* writable */
62#define _STATUS (ioaddr+BUS_ALIGN*0) /* readable */
63#define _COMMAND (ioaddr+BUS_ALIGN*1) /* standard arcnet commands */
64#define _DIAGSTAT (ioaddr+BUS_ALIGN*1) /* diagnostic status register */
65#define _ADDR_HI (ioaddr+BUS_ALIGN*2) /* control registers for IO-mapped memory */
66#define _ADDR_LO (ioaddr+BUS_ALIGN*3)
67#define _MEMDATA (ioaddr+BUS_ALIGN*4) /* data port for IO-mapped memory */
68#define _SUBADR (ioaddr+BUS_ALIGN*5) /* the extended port _XREG refers to */
69#define _CONFIG (ioaddr+BUS_ALIGN*6) /* configuration register */
70#define _XREG (ioaddr+BUS_ALIGN*7) /* extra registers (indexed by _CONFIG
71 or _SUBADR) */
72
73/* in the ADDR_HI register */
74#define RDDATAflag 0x80 /* next access is a read (not a write) */
75
76/* in the DIAGSTAT register */
77#define NEWNXTIDflag 0x02 /* ID to which token is passed has changed */
78
79/* in the CONFIG register */
80#define RESETcfg 0x80 /* put card in reset state */
81#define TXENcfg 0x20 /* enable TX */
82
83/* in SETUP register */
84#define PROMISCset 0x10 /* enable RCV_ALL */
85#define P1MODE 0x80 /* enable P1-MODE for Backplane */
86#define SLOWARB 0x01 /* enable Slow Arbitration for >=5Mbps */
87
88/* COM2002x */
89#define SUB_TENTATIVE 0 /* tentative node ID */
90#define SUB_NODE 1 /* node ID */
91#define SUB_SETUP1 2 /* various options */
92#define SUB_TEST 3 /* test/diag register */
93
94/* COM20022 only */
95#define SUB_SETUP2 4 /* sundry options */
96#define SUB_BUSCTL 5 /* bus control options */
97#define SUB_DMACOUNT 6 /* DMA count options */
98
99#define SET_SUBADR(x) do { \
100 if ((x) < 4) \
101 { \
102 lp->config = (lp->config & ~0x03) | (x); \
103 SETCONF; \
104 } \
105 else \
106 { \
107 outb(x, _SUBADR); \
108 } \
109} while (0)
110
111#undef ARCRESET
112#undef ASTATUS
113#undef ACOMMAND
114#undef AINTMASK
115
116#define ARCRESET { outb(lp->config | 0x80, _CONFIG); \
117 udelay(5); \
118 outb(lp->config , _CONFIG); \
119 }
120#define ARCRESET0 { outb(0x18 | 0x80, _CONFIG); \
121 udelay(5); \
122 outb(0x18 , _CONFIG); \
123 }
124
125#define ASTATUS() inb(_STATUS)
126#define ADIAGSTATUS() inb(_DIAGSTAT)
127#define ACOMMAND(cmd) outb((cmd),_COMMAND)
128#define AINTMASK(msk) outb((msk),_INTMASK)
129
130#define SETCONF outb(lp->config, _CONFIG)
131
132#endif /* __COM20020_H */