1 /* 2 * arch/arm/include/asm/ecard.h 3 * 4 * definitions for expansion cards 5 * 6 * This is a new system as from Linux 1.2.3 7 * 8 * Changelog: 9 * 11-12-1996 RMK Further minor improvements 10 * 12-09-1997 RMK Added interrupt enable/disable for card level 11 * 12 * Reference: Acorns Risc OS 3 Programmers Reference Manuals. 13 */ 14 15 #ifndef __ASM_ECARD_H 16 #define __ASM_ECARD_H 17 18 /* 19 * Currently understood cards (but not necessarily 20 * supported): 21 * Manufacturer Product ID 22 */ 23 #define MANU_ACORN 0x0000 24 #define PROD_ACORN_SCSI 0x0002 25 #define PROD_ACORN_ETHER1 0x0003 26 #define PROD_ACORN_MFM 0x000b 27 28 #define MANU_ANT2 0x0011 29 #define PROD_ANT_ETHER3 0x00a4 30 31 #define MANU_ATOMWIDE 0x0017 32 #define PROD_ATOMWIDE_3PSERIAL 0x0090 33 34 #define MANU_IRLAM_INSTRUMENTS 0x001f 35 #define MANU_IRLAM_INSTRUMENTS_ETHERN 0x5678 36 37 #define MANU_OAK 0x0021 38 #define PROD_OAK_SCSI 0x0058 39 40 #define MANU_MORLEY 0x002b 41 #define PROD_MORLEY_SCSI_UNCACHED 0x0067 42 43 #define MANU_CUMANA 0x003a 44 #define PROD_CUMANA_SCSI_2 0x003a 45 #define PROD_CUMANA_SCSI_1 0x00a0 46 47 #define MANU_ICS 0x003c 48 #define PROD_ICS_IDE 0x00ae 49 50 #define MANU_ICS2 0x003d 51 #define PROD_ICS2_IDE 0x00ae 52 53 #define MANU_SERPORT 0x003f 54 #define PROD_SERPORT_DSPORT 0x00b9 55 56 #define MANU_ARXE 0x0041 57 #define PROD_ARXE_SCSI 0x00be 58 59 #define MANU_I3 0x0046 60 #define PROD_I3_ETHERLAN500 0x00d4 61 #define PROD_I3_ETHERLAN600 0x00ec 62 #define PROD_I3_ETHERLAN600A 0x011e 63 64 #define MANU_ANT 0x0053 65 #define PROD_ANT_ETHERM 0x00d8 66 #define PROD_ANT_ETHERB 0x00e4 67 68 #define MANU_ALSYSTEMS 0x005b 69 #define PROD_ALSYS_SCSIATAPI 0x0107 70 71 #define MANU_MCS 0x0063 72 #define PROD_MCS_CONNECT32 0x0125 73 74 #define MANU_EESOX 0x0064 75 #define PROD_EESOX_SCSI2 0x008c 76 77 #define MANU_YELLOWSTONE 0x0096 78 #define PROD_YELLOWSTONE_RAPIDE32 0x0120 79 80 #ifdef ECARD_C 81 #define CONST 82 #else 83 #define CONST const 84 #endif 85 86 #define MAX_ECARDS 9 87 88 struct ecard_id { /* Card ID structure */ 89 unsigned short manufacturer; 90 unsigned short product; 91 void *data; 92 }; 93 94 struct in_ecid { /* Packed card ID information */ 95 unsigned short product; /* Product code */ 96 unsigned short manufacturer; /* Manufacturer code */ 97 unsigned char id:4; /* Simple ID */ 98 unsigned char cd:1; /* Chunk dir present */ 99 unsigned char is:1; /* Interrupt status pointers */ 100 unsigned char w:2; /* Width */ 101 unsigned char country; /* Country */ 102 unsigned char irqmask; /* IRQ mask */ 103 unsigned char fiqmask; /* FIQ mask */ 104 unsigned long irqoff; /* IRQ offset */ 105 unsigned long fiqoff; /* FIQ offset */ 106 }; 107 108 typedef struct expansion_card ecard_t; 109 typedef unsigned long *loader_t; 110 111 typedef struct expansion_card_ops { /* Card handler routines */ 112 void (*irqenable)(ecard_t *ec, int irqnr); 113 void (*irqdisable)(ecard_t *ec, int irqnr); 114 int (*irqpending)(ecard_t *ec); 115 void (*fiqenable)(ecard_t *ec, int fiqnr); 116 void (*fiqdisable)(ecard_t *ec, int fiqnr); 117 int (*fiqpending)(ecard_t *ec); 118 } expansioncard_ops_t; 119 120 #define ECARD_NUM_RESOURCES (6) 121 122 #define ECARD_RES_IOCSLOW (0) 123 #define ECARD_RES_IOCMEDIUM (1) 124 #define ECARD_RES_IOCFAST (2) 125 #define ECARD_RES_IOCSYNC (3) 126 #define ECARD_RES_MEMC (4) 127 #define ECARD_RES_EASI (5) 128 129 #define ecard_resource_start(ec,nr) ((ec)->resource[nr].start) 130 #define ecard_resource_end(ec,nr) ((ec)->resource[nr].end) 131 #define ecard_resource_len(ec,nr) ((ec)->resource[nr].end - \ 132 (ec)->resource[nr].start + 1) 133 #define ecard_resource_flags(ec,nr) ((ec)->resource[nr].flags) 134 135 /* 136 * This contains all the info needed on an expansion card 137 */ 138 struct expansion_card { 139 struct expansion_card *next; 140 141 struct device dev; 142 struct resource resource[ECARD_NUM_RESOURCES]; 143 144 /* Public data */ 145 void __iomem *irqaddr; /* address of IRQ register */ 146 void __iomem *fiqaddr; /* address of FIQ register */ 147 unsigned char irqmask; /* IRQ mask */ 148 unsigned char fiqmask; /* FIQ mask */ 149 unsigned char claimed; /* Card claimed? */ 150 unsigned char easi; /* EASI card */ 151 152 void *irq_data; /* Data for use for IRQ by card */ 153 void *fiq_data; /* Data for use for FIQ by card */ 154 const expansioncard_ops_t *ops; /* Enable/Disable Ops for card */ 155 156 CONST unsigned int slot_no; /* Slot number */ 157 CONST unsigned int dma; /* DMA number (for request_dma) */ 158 CONST unsigned int irq; /* IRQ number (for request_irq) */ 159 CONST unsigned int fiq; /* FIQ number (for request_irq) */ 160 CONST struct in_ecid cid; /* Card Identification */ 161 162 /* Private internal data */ 163 const char *card_desc; /* Card description */ 164 CONST unsigned int podaddr; /* Base Linux address for card */ 165 CONST loader_t loader; /* loader program */ 166 u64 dma_mask; 167 }; 168 169 void ecard_setirq(struct expansion_card *ec, const struct expansion_card_ops *ops, void *irq_data); 170 171 struct in_chunk_dir { 172 unsigned int start_offset; 173 union { 174 unsigned char string[256]; 175 unsigned char data[1]; 176 } d; 177 }; 178 179 /* 180 * Read a chunk from an expansion card 181 * cd : where to put read data 182 * ec : expansion card info struct 183 * id : id number to find 184 * num: (n+1)'th id to find. 185 */ 186 extern int ecard_readchunk (struct in_chunk_dir *cd, struct expansion_card *ec, int id, int num); 187 188 /* 189 * Request and release ecard resources 190 */ 191 extern int ecard_request_resources(struct expansion_card *ec); 192 extern void ecard_release_resources(struct expansion_card *ec); 193 194 void __iomem *ecardm_iomap(struct expansion_card *ec, unsigned int res, 195 unsigned long offset, unsigned long maxsize); 196 #define ecardm_iounmap(__ec, __addr) devm_iounmap(&(__ec)->dev, __addr) 197 198 extern struct bus_type ecard_bus_type; 199 200 #define ECARD_DEV(_d) container_of((_d), struct expansion_card, dev) 201 202 struct ecard_driver { 203 int (*probe)(struct expansion_card *, const struct ecard_id *id); 204 void (*remove)(struct expansion_card *); 205 void (*shutdown)(struct expansion_card *); 206 const struct ecard_id *id_table; 207 unsigned int id; 208 struct device_driver drv; 209 }; 210 211 #define ECARD_DRV(_d) container_of((_d), struct ecard_driver, drv) 212 213 #define ecard_set_drvdata(ec,data) dev_set_drvdata(&(ec)->dev, (data)) 214 #define ecard_get_drvdata(ec) dev_get_drvdata(&(ec)->dev) 215 216 int ecard_register_driver(struct ecard_driver *); 217 void ecard_remove_driver(struct ecard_driver *); 218 219 #endif 220