cyclades.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. /* $Revision: 3.0 $$Date: 1998/11/02 14:20:59 $
  2. * linux/include/linux/cyclades.h
  3. *
  4. * This file was initially written by
  5. * Randolph Bentson <bentson@grieg.seaslug.org> and is maintained by
  6. * Ivan Passos <ivan@cyclades.com>.
  7. *
  8. * This file contains the general definitions for the cyclades.c driver
  9. *$Log: cyclades.h,v $
  10. *Revision 3.1 2002/01/29 11:36:16 henrique
  11. *added throttle field on struct cyclades_port to indicate whether the
  12. *port is throttled or not
  13. *
  14. *Revision 3.1 2000/04/19 18:52:52 ivan
  15. *converted address fields to unsigned long and added fields for physical
  16. *addresses on cyclades_card structure;
  17. *
  18. *Revision 3.0 1998/11/02 14:20:59 ivan
  19. *added nports field on cyclades_card structure;
  20. *
  21. *Revision 2.5 1998/08/03 16:57:01 ivan
  22. *added cyclades_idle_stats structure;
  23. *
  24. *Revision 2.4 1998/06/01 12:09:53 ivan
  25. *removed closing_wait2 from cyclades_port structure;
  26. *
  27. *Revision 2.3 1998/03/16 18:01:12 ivan
  28. *changes in the cyclades_port structure to get it closer to the
  29. *standard serial port structure;
  30. *added constants for new ioctls;
  31. *
  32. *Revision 2.2 1998/02/17 16:50:00 ivan
  33. *changes in the cyclades_port structure (addition of shutdown_wait and
  34. *chip_rev variables);
  35. *added constants for new ioctls and for CD1400 rev. numbers.
  36. *
  37. *Revision 2.1 1997/10/24 16:03:00 ivan
  38. *added rflow (which allows enabling the CD1400 special flow control
  39. *feature) and rtsdtr_inv (which allows DTR/RTS pin inversion) to
  40. *cyclades_port structure;
  41. *added Alpha support
  42. *
  43. *Revision 2.0 1997/06/30 10:30:00 ivan
  44. *added some new doorbell command constants related to IOCTLW and
  45. *UART error signaling
  46. *
  47. *Revision 1.8 1997/06/03 15:30:00 ivan
  48. *added constant ZFIRM_HLT
  49. *added constant CyPCI_Ze_win ( = 2 * Cy_PCI_Zwin)
  50. *
  51. *Revision 1.7 1997/03/26 10:30:00 daniel
  52. *new entries at the end of cyclades_port struct to reallocate
  53. *variables illegally allocated within card memory.
  54. *
  55. *Revision 1.6 1996/09/09 18:35:30 bentson
  56. *fold in changes for Cyclom-Z -- including structures for
  57. *communicating with board as well modest changes to original
  58. *structures to support new features.
  59. *
  60. *Revision 1.5 1995/11/13 21:13:31 bentson
  61. *changes suggested by Michael Chastain <mec@duracef.shout.net>
  62. *to support use of this file in non-kernel applications
  63. *
  64. *
  65. */
  66. #ifndef _LINUX_CYCLADES_H
  67. #define _LINUX_CYCLADES_H
  68. #include <uapi/linux/cyclades.h>
  69. /* Per card data structure */
  70. struct cyclades_card {
  71. void __iomem *base_addr;
  72. union {
  73. void __iomem *p9050;
  74. struct RUNTIME_9060 __iomem *p9060;
  75. } ctl_addr;
  76. struct BOARD_CTRL __iomem *board_ctrl; /* cyz specific */
  77. int irq;
  78. unsigned int num_chips; /* 0 if card absent, -1 if Z/PCI, else Y */
  79. unsigned int first_line; /* minor number of first channel on card */
  80. unsigned int nports; /* Number of ports in the card */
  81. int bus_index; /* address shift - 0 for ISA, 1 for PCI */
  82. int intr_enabled; /* FW Interrupt flag - 0 disabled, 1 enabled */
  83. u32 hw_ver;
  84. spinlock_t card_lock;
  85. struct cyclades_port *ports;
  86. };
  87. /***************************************
  88. * Memory access functions/macros *
  89. * (required to support Alpha systems) *
  90. ***************************************/
  91. #define cy_writeb(port,val) do { writeb((val), (port)); mb(); } while (0)
  92. #define cy_writew(port,val) do { writew((val), (port)); mb(); } while (0)
  93. #define cy_writel(port,val) do { writel((val), (port)); mb(); } while (0)
  94. /*
  95. * Statistics counters
  96. */
  97. struct cyclades_icount {
  98. __u32 cts, dsr, rng, dcd, tx, rx;
  99. __u32 frame, parity, overrun, brk;
  100. __u32 buf_overrun;
  101. };
  102. /*
  103. * This is our internal structure for each serial port's state.
  104. *
  105. * Many fields are paralleled by the structure used by the serial_struct
  106. * structure.
  107. *
  108. * For definitions of the flags field, see tty.h
  109. */
  110. struct cyclades_port {
  111. int magic;
  112. struct tty_port port;
  113. struct cyclades_card *card;
  114. union {
  115. struct {
  116. void __iomem *base_addr;
  117. } cyy;
  118. struct {
  119. struct CH_CTRL __iomem *ch_ctrl;
  120. struct BUF_CTRL __iomem *buf_ctrl;
  121. } cyz;
  122. } u;
  123. int line;
  124. int flags; /* defined in tty.h */
  125. int type; /* UART type */
  126. int read_status_mask;
  127. int ignore_status_mask;
  128. int timeout;
  129. int xmit_fifo_size;
  130. int cor1,cor2,cor3,cor4,cor5;
  131. int tbpr,tco,rbpr,rco;
  132. int baud;
  133. int rflow;
  134. int rtsdtr_inv;
  135. int chip_rev;
  136. int custom_divisor;
  137. u8 x_char; /* to be pushed out ASAP */
  138. int breakon;
  139. int breakoff;
  140. int xmit_head;
  141. int xmit_tail;
  142. int xmit_cnt;
  143. int default_threshold;
  144. int default_timeout;
  145. unsigned long rflush_count;
  146. struct cyclades_monitor mon;
  147. struct cyclades_idle_stats idle_stats;
  148. struct cyclades_icount icount;
  149. struct completion shutdown_wait;
  150. int throttle;
  151. };
  152. #define CLOSING_WAIT_DELAY 30*HZ
  153. #define CY_CLOSING_WAIT_NONE ASYNC_CLOSING_WAIT_NONE
  154. #define CY_CLOSING_WAIT_INF ASYNC_CLOSING_WAIT_INF
  155. #define CyMAX_CHIPS_PER_CARD 8
  156. #define CyMAX_CHAR_FIFO 12
  157. #define CyPORTS_PER_CHIP 4
  158. #define CD1400_MAX_SPEED 115200
  159. #define CyISA_Ywin 0x2000
  160. #define CyPCI_Ywin 0x4000
  161. #define CyPCI_Yctl 0x80
  162. #define CyPCI_Zctl CTRL_WINDOW_SIZE
  163. #define CyPCI_Zwin 0x80000
  164. #define CyPCI_Ze_win (2 * CyPCI_Zwin)
  165. #define PCI_DEVICE_ID_MASK 0x06
  166. /**** CD1400 registers ****/
  167. #define CD1400_REV_G 0x46
  168. #define CD1400_REV_J 0x48
  169. #define CyRegSize 0x0400
  170. #define Cy_HwReset 0x1400
  171. #define Cy_ClrIntr 0x1800
  172. #define Cy_EpldRev 0x1e00
  173. /* Global Registers */
  174. #define CyGFRCR (0x40*2)
  175. #define CyRevE (44)
  176. #define CyCAR (0x68*2)
  177. #define CyCHAN_0 (0x00)
  178. #define CyCHAN_1 (0x01)
  179. #define CyCHAN_2 (0x02)
  180. #define CyCHAN_3 (0x03)
  181. #define CyGCR (0x4B*2)
  182. #define CyCH0_SERIAL (0x00)
  183. #define CyCH0_PARALLEL (0x80)
  184. #define CySVRR (0x67*2)
  185. #define CySRModem (0x04)
  186. #define CySRTransmit (0x02)
  187. #define CySRReceive (0x01)
  188. #define CyRICR (0x44*2)
  189. #define CyTICR (0x45*2)
  190. #define CyMICR (0x46*2)
  191. #define CyICR0 (0x00)
  192. #define CyICR1 (0x01)
  193. #define CyICR2 (0x02)
  194. #define CyICR3 (0x03)
  195. #define CyRIR (0x6B*2)
  196. #define CyTIR (0x6A*2)
  197. #define CyMIR (0x69*2)
  198. #define CyIRDirEq (0x80)
  199. #define CyIRBusy (0x40)
  200. #define CyIRUnfair (0x20)
  201. #define CyIRContext (0x1C)
  202. #define CyIRChannel (0x03)
  203. #define CyPPR (0x7E*2)
  204. #define CyCLOCK_20_1MS (0x27)
  205. #define CyCLOCK_25_1MS (0x31)
  206. #define CyCLOCK_25_5MS (0xf4)
  207. #define CyCLOCK_60_1MS (0x75)
  208. #define CyCLOCK_60_2MS (0xea)
  209. /* Virtual Registers */
  210. #define CyRIVR (0x43*2)
  211. #define CyTIVR (0x42*2)
  212. #define CyMIVR (0x41*2)
  213. #define CyIVRMask (0x07)
  214. #define CyIVRRxEx (0x07)
  215. #define CyIVRRxOK (0x03)
  216. #define CyIVRTxOK (0x02)
  217. #define CyIVRMdmOK (0x01)
  218. #define CyTDR (0x63*2)
  219. #define CyRDSR (0x62*2)
  220. #define CyTIMEOUT (0x80)
  221. #define CySPECHAR (0x70)
  222. #define CyBREAK (0x08)
  223. #define CyPARITY (0x04)
  224. #define CyFRAME (0x02)
  225. #define CyOVERRUN (0x01)
  226. #define CyMISR (0x4C*2)
  227. /* see CyMCOR_ and CyMSVR_ for bits*/
  228. #define CyEOSRR (0x60*2)
  229. /* Channel Registers */
  230. #define CyLIVR (0x18*2)
  231. #define CyMscsr (0x01)
  232. #define CyTdsr (0x02)
  233. #define CyRgdsr (0x03)
  234. #define CyRedsr (0x07)
  235. #define CyCCR (0x05*2)
  236. /* Format 1 */
  237. #define CyCHAN_RESET (0x80)
  238. #define CyCHIP_RESET (0x81)
  239. #define CyFlushTransFIFO (0x82)
  240. /* Format 2 */
  241. #define CyCOR_CHANGE (0x40)
  242. #define CyCOR1ch (0x02)
  243. #define CyCOR2ch (0x04)
  244. #define CyCOR3ch (0x08)
  245. /* Format 3 */
  246. #define CySEND_SPEC_1 (0x21)
  247. #define CySEND_SPEC_2 (0x22)
  248. #define CySEND_SPEC_3 (0x23)
  249. #define CySEND_SPEC_4 (0x24)
  250. /* Format 4 */
  251. #define CyCHAN_CTL (0x10)
  252. #define CyDIS_RCVR (0x01)
  253. #define CyENB_RCVR (0x02)
  254. #define CyDIS_XMTR (0x04)
  255. #define CyENB_XMTR (0x08)
  256. #define CySRER (0x06*2)
  257. #define CyMdmCh (0x80)
  258. #define CyRxData (0x10)
  259. #define CyTxRdy (0x04)
  260. #define CyTxMpty (0x02)
  261. #define CyNNDT (0x01)
  262. #define CyCOR1 (0x08*2)
  263. #define CyPARITY_NONE (0x00)
  264. #define CyPARITY_0 (0x20)
  265. #define CyPARITY_1 (0xA0)
  266. #define CyPARITY_E (0x40)
  267. #define CyPARITY_O (0xC0)
  268. #define Cy_1_STOP (0x00)
  269. #define Cy_1_5_STOP (0x04)
  270. #define Cy_2_STOP (0x08)
  271. #define Cy_5_BITS (0x00)
  272. #define Cy_6_BITS (0x01)
  273. #define Cy_7_BITS (0x02)
  274. #define Cy_8_BITS (0x03)
  275. #define CyCOR2 (0x09*2)
  276. #define CyIXM (0x80)
  277. #define CyTxIBE (0x40)
  278. #define CyETC (0x20)
  279. #define CyAUTO_TXFL (0x60)
  280. #define CyLLM (0x10)
  281. #define CyRLM (0x08)
  282. #define CyRtsAO (0x04)
  283. #define CyCtsAE (0x02)
  284. #define CyDsrAE (0x01)
  285. #define CyCOR3 (0x0A*2)
  286. #define CySPL_CH_DRANGE (0x80) /* special character detect range */
  287. #define CySPL_CH_DET1 (0x40) /* enable special character detection
  288. on SCHR4-SCHR3 */
  289. #define CyFL_CTRL_TRNSP (0x20) /* Flow Control Transparency */
  290. #define CySPL_CH_DET2 (0x10) /* Enable special character detection
  291. on SCHR2-SCHR1 */
  292. #define CyREC_FIFO (0x0F) /* Receive FIFO threshold */
  293. #define CyCOR4 (0x1E*2)
  294. #define CyCOR5 (0x1F*2)
  295. #define CyCCSR (0x0B*2)
  296. #define CyRxEN (0x80)
  297. #define CyRxFloff (0x40)
  298. #define CyRxFlon (0x20)
  299. #define CyTxEN (0x08)
  300. #define CyTxFloff (0x04)
  301. #define CyTxFlon (0x02)
  302. #define CyRDCR (0x0E*2)
  303. #define CySCHR1 (0x1A*2)
  304. #define CySCHR2 (0x1B*2)
  305. #define CySCHR3 (0x1C*2)
  306. #define CySCHR4 (0x1D*2)
  307. #define CySCRL (0x22*2)
  308. #define CySCRH (0x23*2)
  309. #define CyLNC (0x24*2)
  310. #define CyMCOR1 (0x15*2)
  311. #define CyMCOR2 (0x16*2)
  312. #define CyRTPR (0x21*2)
  313. #define CyMSVR1 (0x6C*2)
  314. #define CyMSVR2 (0x6D*2)
  315. #define CyANY_DELTA (0xF0)
  316. #define CyDSR (0x80)
  317. #define CyCTS (0x40)
  318. #define CyRI (0x20)
  319. #define CyDCD (0x10)
  320. #define CyDTR (0x02)
  321. #define CyRTS (0x01)
  322. #define CyPVSR (0x6F*2)
  323. #define CyRBPR (0x78*2)
  324. #define CyRCOR (0x7C*2)
  325. #define CyTBPR (0x72*2)
  326. #define CyTCOR (0x76*2)
  327. /* Custom Registers */
  328. #define CyPLX_VER (0x3400)
  329. #define PLX_9050 0x0b
  330. #define PLX_9060 0x0c
  331. #define PLX_9080 0x0d
  332. /***************************************************************************/
  333. #endif /* _LINUX_CYCLADES_H */