2 * linux/include/asm-arm/ecard.h
4 * definitions for expansion cards
6 * This is a new system as from Linux 1.2.3
9 * 11-12-1996 RMK Further minor improvements
10 * 12-09-1997 RMK Added interrupt enable/disable for card level
12 * Reference: Acorns Risc OS 3 Programmers Reference Manuals.
19 * Currently understood cards (but not necessarily
21 * Manufacturer Product ID
23 #define MANU_ACORN 0x0000
24 #define PROD_ACORN_SCSI 0x0002
25 #define PROD_ACORN_ETHER1 0x0003
26 #define PROD_ACORN_MFM 0x000b
28 #define MANU_ANT2 0x0011
29 #define PROD_ANT_ETHER3 0x00a4
31 #define MANU_ATOMWIDE 0x0017
32 #define PROD_ATOMWIDE_3PSERIAL 0x0090
34 #define MANU_IRLAM_INSTRUMENTS 0x001f
35 #define MANU_IRLAM_INSTRUMENTS_ETHERN 0x5678
37 #define MANU_OAK 0x0021
38 #define PROD_OAK_SCSI 0x0058
40 #define MANU_MORLEY 0x002b
41 #define PROD_MORLEY_SCSI_UNCACHED 0x0067
43 #define MANU_CUMANA 0x003a
44 #define PROD_CUMANA_SCSI_2 0x003a
45 #define PROD_CUMANA_SCSI_1 0x00a0
47 #define MANU_ICS 0x003c
48 #define PROD_ICS_IDE 0x00ae
50 #define MANU_ICS2 0x003d
51 #define PROD_ICS2_IDE 0x00ae
53 #define MANU_SERPORT 0x003f
54 #define PROD_SERPORT_DSPORT 0x00b9
56 #define MANU_ARXE 0x0041
57 #define PROD_ARXE_SCSI 0x00be
59 #define MANU_I3 0x0046
60 #define PROD_I3_ETHERLAN500 0x00d4
61 #define PROD_I3_ETHERLAN600 0x00ec
62 #define PROD_I3_ETHERLAN600A 0x011e
64 #define MANU_ANT 0x0053
65 #define PROD_ANT_ETHERM 0x00d8
66 #define PROD_ANT_ETHERB 0x00e4
68 #define MANU_ALSYSTEMS 0x005b
69 #define PROD_ALSYS_SCSIATAPI 0x0107
71 #define MANU_MCS 0x0063
72 #define PROD_MCS_CONNECT32 0x0125
74 #define MANU_EESOX 0x0064
75 #define PROD_EESOX_SCSI2 0x008c
77 #define MANU_YELLOWSTONE 0x0096
78 #define PROD_YELLOWSTONE_RAPIDE32 0x0120
88 typedef enum { /* Cards address space */
94 typedef enum { /* Speed for ECARD_IOC space */
101 struct ecard_id { /* Card ID structure */
102 unsigned short manufacturer;
103 unsigned short product;
107 struct in_ecid { /* Packed card ID information */
108 unsigned short product; /* Product code */
109 unsigned short manufacturer; /* Manufacturer code */
110 unsigned char id:4; /* Simple ID */
111 unsigned char cd:1; /* Chunk dir present */
112 unsigned char is:1; /* Interrupt status pointers */
113 unsigned char w:2; /* Width */
114 unsigned char country; /* Country */
115 unsigned char irqmask; /* IRQ mask */
116 unsigned char fiqmask; /* FIQ mask */
117 unsigned long irqoff; /* IRQ offset */
118 unsigned long fiqoff; /* FIQ offset */
121 typedef struct expansion_card ecard_t;
122 typedef unsigned long *loader_t;
124 typedef struct { /* Card handler routines */
125 void (*irqenable)(ecard_t *ec, int irqnr);
126 void (*irqdisable)(ecard_t *ec, int irqnr);
127 int (*irqpending)(ecard_t *ec);
128 void (*fiqenable)(ecard_t *ec, int fiqnr);
129 void (*fiqdisable)(ecard_t *ec, int fiqnr);
130 int (*fiqpending)(ecard_t *ec);
131 } expansioncard_ops_t;
133 #define ECARD_NUM_RESOURCES (6)
135 #define ECARD_RES_IOCSLOW (0)
136 #define ECARD_RES_IOCMEDIUM (1)
137 #define ECARD_RES_IOCFAST (2)
138 #define ECARD_RES_IOCSYNC (3)
139 #define ECARD_RES_MEMC (4)
140 #define ECARD_RES_EASI (5)
142 #define ecard_resource_start(ec,nr) ((ec)->resource[nr].start)
143 #define ecard_resource_end(ec,nr) ((ec)->resource[nr].end)
144 #define ecard_resource_len(ec,nr) ((ec)->resource[nr].end - \
145 (ec)->resource[nr].start + 1)
146 #define ecard_resource_flags(ec,nr) ((ec)->resource[nr].flags)
149 * This contains all the info needed on an expansion card
151 struct expansion_card {
152 struct expansion_card *next;
155 struct resource resource[ECARD_NUM_RESOURCES];
158 void __iomem *irqaddr; /* address of IRQ register */
159 void __iomem *fiqaddr; /* address of FIQ register */
160 unsigned char irqmask; /* IRQ mask */
161 unsigned char fiqmask; /* FIQ mask */
162 unsigned char claimed; /* Card claimed? */
163 unsigned char easi; /* EASI card */
165 void *irq_data; /* Data for use for IRQ by card */
166 void *fiq_data; /* Data for use for FIQ by card */
167 const expansioncard_ops_t *ops; /* Enable/Disable Ops for card */
169 CONST unsigned int slot_no; /* Slot number */
170 CONST unsigned int dma; /* DMA number (for request_dma) */
171 CONST unsigned int irq; /* IRQ number (for request_irq) */
172 CONST unsigned int fiq; /* FIQ number (for request_irq) */
173 CONST struct in_ecid cid; /* Card Identification */
175 /* Private internal data */
176 const char *card_desc; /* Card description */
177 CONST unsigned int podaddr; /* Base Linux address for card */
178 CONST loader_t loader; /* loader program */
182 struct in_chunk_dir {
183 unsigned int start_offset;
185 unsigned char string[256];
186 unsigned char data[1];
191 * ecard_claim: claim an expansion card entry
193 #define ecard_claim(ec) ((ec)->claimed = 1)
196 * ecard_release: release an expansion card entry
198 #define ecard_release(ec) ((ec)->claimed = 0)
201 * Read a chunk from an expansion card
202 * cd : where to put read data
203 * ec : expansion card info struct
204 * id : id number to find
205 * num: (n+1)'th id to find.
207 extern int ecard_readchunk (struct in_chunk_dir *cd, struct expansion_card *ec, int id, int num);
210 * Obtain the address of a card. This returns the "old style" address
211 * and should no longer be used.
213 static inline unsigned int __deprecated
214 ecard_address(struct expansion_card *ec, card_type_t type, card_speed_t speed)
216 extern unsigned int __ecard_address(struct expansion_card *,
217 card_type_t, card_speed_t);
218 return __ecard_address(ec, type, speed);
222 * Request and release ecard resources
224 extern int ecard_request_resources(struct expansion_card *ec);
225 extern void ecard_release_resources(struct expansion_card *ec);
227 extern struct bus_type ecard_bus_type;
229 #define ECARD_DEV(_d) container_of((_d), struct expansion_card, dev)
231 struct ecard_driver {
232 int (*probe)(struct expansion_card *, const struct ecard_id *id);
233 void (*remove)(struct expansion_card *);
234 void (*shutdown)(struct expansion_card *);
235 const struct ecard_id *id_table;
237 struct device_driver drv;
240 #define ECARD_DRV(_d) container_of((_d), struct ecard_driver, drv)
242 #define ecard_set_drvdata(ec,data) dev_set_drvdata(&(ec)->dev, (data))
243 #define ecard_get_drvdata(ec) dev_get_drvdata(&(ec)->dev)
245 int ecard_register_driver(struct ecard_driver *);
246 void ecard_remove_driver(struct ecard_driver *);