ecard.h 5.9 KB

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