ioc3.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. /*
  2. * Copyright (C) 1999, 2000 Ralf Baechle
  3. * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
  4. */
  5. #ifndef _IOC3_H
  6. #define _IOC3_H
  7. #include <linux/types.h>
  8. /* SUPERIO uart register map */
  9. typedef volatile struct ioc3_uartregs {
  10. union {
  11. volatile u8 rbr; /* read only, DLAB == 0 */
  12. volatile u8 thr; /* write only, DLAB == 0 */
  13. volatile u8 dll; /* DLAB == 1 */
  14. } u1;
  15. union {
  16. volatile u8 ier; /* DLAB == 0 */
  17. volatile u8 dlm; /* DLAB == 1 */
  18. } u2;
  19. union {
  20. volatile u8 iir; /* read only */
  21. volatile u8 fcr; /* write only */
  22. } u3;
  23. volatile u8 iu_lcr;
  24. volatile u8 iu_mcr;
  25. volatile u8 iu_lsr;
  26. volatile u8 iu_msr;
  27. volatile u8 iu_scr;
  28. } ioc3_uregs_t;
  29. #define iu_rbr u1.rbr
  30. #define iu_thr u1.thr
  31. #define iu_dll u1.dll
  32. #define iu_ier u2.ier
  33. #define iu_dlm u2.dlm
  34. #define iu_iir u3.iir
  35. #define iu_fcr u3.fcr
  36. struct ioc3_sioregs {
  37. volatile u8 fill[0x141]; /* starts at 0x141 */
  38. volatile u8 uartc;
  39. volatile u8 kbdcg;
  40. volatile u8 fill0[0x150 - 0x142 - 1];
  41. volatile u8 pp_data;
  42. volatile u8 pp_dsr;
  43. volatile u8 pp_dcr;
  44. volatile u8 fill1[0x158 - 0x152 - 1];
  45. volatile u8 pp_fifa;
  46. volatile u8 pp_cfgb;
  47. volatile u8 pp_ecr;
  48. volatile u8 fill2[0x168 - 0x15a - 1];
  49. volatile u8 rtcad;
  50. volatile u8 rtcdat;
  51. volatile u8 fill3[0x170 - 0x169 - 1];
  52. struct ioc3_uartregs uartb; /* 0x20170 */
  53. struct ioc3_uartregs uarta; /* 0x20178 */
  54. };
  55. /* Register layout of IOC3 in configuration space. */
  56. struct ioc3 {
  57. volatile u32 pad0[7]; /* 0x00000 */
  58. volatile u32 sio_ir; /* 0x0001c */
  59. volatile u32 sio_ies; /* 0x00020 */
  60. volatile u32 sio_iec; /* 0x00024 */
  61. volatile u32 sio_cr; /* 0x00028 */
  62. volatile u32 int_out; /* 0x0002c */
  63. volatile u32 mcr; /* 0x00030 */
  64. /* General Purpose I/O registers */
  65. volatile u32 gpcr_s; /* 0x00034 */
  66. volatile u32 gpcr_c; /* 0x00038 */
  67. volatile u32 gpdr; /* 0x0003c */
  68. volatile u32 gppr_0; /* 0x00040 */
  69. volatile u32 gppr_1; /* 0x00044 */
  70. volatile u32 gppr_2; /* 0x00048 */
  71. volatile u32 gppr_3; /* 0x0004c */
  72. volatile u32 gppr_4; /* 0x00050 */
  73. volatile u32 gppr_5; /* 0x00054 */
  74. volatile u32 gppr_6; /* 0x00058 */
  75. volatile u32 gppr_7; /* 0x0005c */
  76. volatile u32 gppr_8; /* 0x00060 */
  77. volatile u32 gppr_9; /* 0x00064 */
  78. volatile u32 gppr_10; /* 0x00068 */
  79. volatile u32 gppr_11; /* 0x0006c */
  80. volatile u32 gppr_12; /* 0x00070 */
  81. volatile u32 gppr_13; /* 0x00074 */
  82. volatile u32 gppr_14; /* 0x00078 */
  83. volatile u32 gppr_15; /* 0x0007c */
  84. /* Parallel Port Registers */
  85. volatile u32 ppbr_h_a; /* 0x00080 */
  86. volatile u32 ppbr_l_a; /* 0x00084 */
  87. volatile u32 ppcr_a; /* 0x00088 */
  88. volatile u32 ppcr; /* 0x0008c */
  89. volatile u32 ppbr_h_b; /* 0x00090 */
  90. volatile u32 ppbr_l_b; /* 0x00094 */
  91. volatile u32 ppcr_b; /* 0x00098 */
  92. /* Keyboard and Mouse Registers */
  93. volatile u32 km_csr; /* 0x0009c */
  94. volatile u32 k_rd; /* 0x000a0 */
  95. volatile u32 m_rd; /* 0x000a4 */
  96. volatile u32 k_wd; /* 0x000a8 */
  97. volatile u32 m_wd; /* 0x000ac */
  98. /* Serial Port Registers */
  99. volatile u32 sbbr_h; /* 0x000b0 */
  100. volatile u32 sbbr_l; /* 0x000b4 */
  101. volatile u32 sscr_a; /* 0x000b8 */
  102. volatile u32 stpir_a; /* 0x000bc */
  103. volatile u32 stcir_a; /* 0x000c0 */
  104. volatile u32 srpir_a; /* 0x000c4 */
  105. volatile u32 srcir_a; /* 0x000c8 */
  106. volatile u32 srtr_a; /* 0x000cc */
  107. volatile u32 shadow_a; /* 0x000d0 */
  108. volatile u32 sscr_b; /* 0x000d4 */
  109. volatile u32 stpir_b; /* 0x000d8 */
  110. volatile u32 stcir_b; /* 0x000dc */
  111. volatile u32 srpir_b; /* 0x000e0 */
  112. volatile u32 srcir_b; /* 0x000e4 */
  113. volatile u32 srtr_b; /* 0x000e8 */
  114. volatile u32 shadow_b; /* 0x000ec */
  115. /* Ethernet Registers */
  116. volatile u32 emcr; /* 0x000f0 */
  117. volatile u32 eisr; /* 0x000f4 */
  118. volatile u32 eier; /* 0x000f8 */
  119. volatile u32 ercsr; /* 0x000fc */
  120. volatile u32 erbr_h; /* 0x00100 */
  121. volatile u32 erbr_l; /* 0x00104 */
  122. volatile u32 erbar; /* 0x00108 */
  123. volatile u32 ercir; /* 0x0010c */
  124. volatile u32 erpir; /* 0x00110 */
  125. volatile u32 ertr; /* 0x00114 */
  126. volatile u32 etcsr; /* 0x00118 */
  127. volatile u32 ersr; /* 0x0011c */
  128. volatile u32 etcdc; /* 0x00120 */
  129. volatile u32 ebir; /* 0x00124 */
  130. volatile u32 etbr_h; /* 0x00128 */
  131. volatile u32 etbr_l; /* 0x0012c */
  132. volatile u32 etcir; /* 0x00130 */
  133. volatile u32 etpir; /* 0x00134 */
  134. volatile u32 emar_h; /* 0x00138 */
  135. volatile u32 emar_l; /* 0x0013c */
  136. volatile u32 ehar_h; /* 0x00140 */
  137. volatile u32 ehar_l; /* 0x00144 */
  138. volatile u32 micr; /* 0x00148 */
  139. volatile u32 midr_r; /* 0x0014c */
  140. volatile u32 midr_w; /* 0x00150 */
  141. volatile u32 pad1[(0x20000 - 0x00154) / 4];
  142. /* SuperIO Registers XXX */
  143. struct ioc3_sioregs sregs; /* 0x20000 */
  144. volatile u32 pad2[(0x40000 - 0x20180) / 4];
  145. /* SSRAM Diagnostic Access */
  146. volatile u32 ssram[(0x80000 - 0x40000) / 4];
  147. /* Bytebus device offsets
  148. 0x80000 - Access to the generic devices selected with DEV0
  149. 0x9FFFF bytebus DEV_SEL_0
  150. 0xA0000 - Access to the generic devices selected with DEV1
  151. 0xBFFFF bytebus DEV_SEL_1
  152. 0xC0000 - Access to the generic devices selected with DEV2
  153. 0xDFFFF bytebus DEV_SEL_2
  154. 0xE0000 - Access to the generic devices selected with DEV3
  155. 0xFFFFF bytebus DEV_SEL_3 */
  156. };
  157. /*
  158. * Ethernet RX Buffer
  159. */
  160. struct ioc3_erxbuf {
  161. u32 w0; /* first word (valid,bcnt,cksum) */
  162. u32 err; /* second word various errors */
  163. /* next comes n bytes of padding */
  164. /* then the received ethernet frame itself */
  165. };
  166. #define ERXBUF_IPCKSUM_MASK 0x0000ffff
  167. #define ERXBUF_BYTECNT_MASK 0x07ff0000
  168. #define ERXBUF_BYTECNT_SHIFT 16
  169. #define ERXBUF_V 0x80000000
  170. #define ERXBUF_CRCERR 0x00000001 /* aka RSV15 */
  171. #define ERXBUF_FRAMERR 0x00000002 /* aka RSV14 */
  172. #define ERXBUF_CODERR 0x00000004 /* aka RSV13 */
  173. #define ERXBUF_INVPREAMB 0x00000008 /* aka RSV18 */
  174. #define ERXBUF_LOLEN 0x00007000 /* aka RSV2_0 */
  175. #define ERXBUF_HILEN 0x03ff0000 /* aka RSV12_3 */
  176. #define ERXBUF_MULTICAST 0x04000000 /* aka RSV16 */
  177. #define ERXBUF_BROADCAST 0x08000000 /* aka RSV17 */
  178. #define ERXBUF_LONGEVENT 0x10000000 /* aka RSV19 */
  179. #define ERXBUF_BADPKT 0x20000000 /* aka RSV20 */
  180. #define ERXBUF_GOODPKT 0x40000000 /* aka RSV21 */
  181. #define ERXBUF_CARRIER 0x80000000 /* aka RSV22 */
  182. /*
  183. * Ethernet TX Descriptor
  184. */
  185. #define ETXD_DATALEN 104
  186. struct ioc3_etxd {
  187. u32 cmd; /* command field */
  188. u32 bufcnt; /* buffer counts field */
  189. u64 p1; /* buffer pointer 1 */
  190. u64 p2; /* buffer pointer 2 */
  191. u8 data[ETXD_DATALEN]; /* opt. tx data */
  192. };
  193. #define ETXD_BYTECNT_MASK 0x000007ff /* total byte count */
  194. #define ETXD_INTWHENDONE 0x00001000 /* intr when done */
  195. #define ETXD_D0V 0x00010000 /* data 0 valid */
  196. #define ETXD_B1V 0x00020000 /* buf 1 valid */
  197. #define ETXD_B2V 0x00040000 /* buf 2 valid */
  198. #define ETXD_DOCHECKSUM 0x00080000 /* insert ip cksum */
  199. #define ETXD_CHKOFF_MASK 0x07f00000 /* cksum byte offset */
  200. #define ETXD_CHKOFF_SHIFT 20
  201. #define ETXD_D0CNT_MASK 0x0000007f
  202. #define ETXD_B1CNT_MASK 0x0007ff00
  203. #define ETXD_B1CNT_SHIFT 8
  204. #define ETXD_B2CNT_MASK 0x7ff00000
  205. #define ETXD_B2CNT_SHIFT 20
  206. /*
  207. * Bytebus device space
  208. */
  209. #define IOC3_BYTEBUS_DEV0 0x80000L
  210. #define IOC3_BYTEBUS_DEV1 0xa0000L
  211. #define IOC3_BYTEBUS_DEV2 0xc0000L
  212. #define IOC3_BYTEBUS_DEV3 0xe0000L
  213. /* ------------------------------------------------------------------------- */
  214. /* Superio Registers (PIO Access) */
  215. #define IOC3_SIO_BASE 0x20000
  216. #define IOC3_SIO_UARTC (IOC3_SIO_BASE+0x141) /* UART Config */
  217. #define IOC3_SIO_KBDCG (IOC3_SIO_BASE+0x142) /* KBD Config */
  218. #define IOC3_SIO_PP_BASE (IOC3_SIO_BASE+PP_BASE) /* Parallel Port */
  219. #define IOC3_SIO_RTC_BASE (IOC3_SIO_BASE+0x168) /* Real Time Clock */
  220. #define IOC3_SIO_UB_BASE (IOC3_SIO_BASE+UARTB_BASE) /* UART B */
  221. #define IOC3_SIO_UA_BASE (IOC3_SIO_BASE+UARTA_BASE) /* UART A */
  222. /* SSRAM Diagnostic Access */
  223. #define IOC3_SSRAM IOC3_RAM_OFF /* base of SSRAM diagnostic access */
  224. #define IOC3_SSRAM_LEN 0x40000 /* 256kb (address space size, may not be fully populated) */
  225. #define IOC3_SSRAM_DM 0x0000ffff /* data mask */
  226. #define IOC3_SSRAM_PM 0x00010000 /* parity mask */
  227. /* bitmasks for PCI_SCR */
  228. #define PCI_SCR_PAR_RESP_EN 0x00000040 /* enb PCI parity checking */
  229. #define PCI_SCR_SERR_EN 0x00000100 /* enable the SERR# driver */
  230. #define PCI_SCR_DROP_MODE_EN 0x00008000 /* drop pios on parity err */
  231. #define PCI_SCR_RX_SERR (0x1 << 16)
  232. #define PCI_SCR_DROP_MODE (0x1 << 17)
  233. #define PCI_SCR_SIG_PAR_ERR (0x1 << 24)
  234. #define PCI_SCR_SIG_TAR_ABRT (0x1 << 27)
  235. #define PCI_SCR_RX_TAR_ABRT (0x1 << 28)
  236. #define PCI_SCR_SIG_MST_ABRT (0x1 << 29)
  237. #define PCI_SCR_SIG_SERR (0x1 << 30)
  238. #define PCI_SCR_PAR_ERR (0x1 << 31)
  239. /* bitmasks for IOC3_KM_CSR */
  240. #define KM_CSR_K_WRT_PEND 0x00000001 /* kbd port xmitting or resetting */
  241. #define KM_CSR_M_WRT_PEND 0x00000002 /* mouse port xmitting or resetting */
  242. #define KM_CSR_K_LCB 0x00000004 /* Line Cntrl Bit for last KBD write */
  243. #define KM_CSR_M_LCB 0x00000008 /* same for mouse */
  244. #define KM_CSR_K_DATA 0x00000010 /* state of kbd data line */
  245. #define KM_CSR_K_CLK 0x00000020 /* state of kbd clock line */
  246. #define KM_CSR_K_PULL_DATA 0x00000040 /* pull kbd data line low */
  247. #define KM_CSR_K_PULL_CLK 0x00000080 /* pull kbd clock line low */
  248. #define KM_CSR_M_DATA 0x00000100 /* state of ms data line */
  249. #define KM_CSR_M_CLK 0x00000200 /* state of ms clock line */
  250. #define KM_CSR_M_PULL_DATA 0x00000400 /* pull ms data line low */
  251. #define KM_CSR_M_PULL_CLK 0x00000800 /* pull ms clock line low */
  252. #define KM_CSR_EMM_MODE 0x00001000 /* emulation mode */
  253. #define KM_CSR_SIM_MODE 0x00002000 /* clock X8 */
  254. #define KM_CSR_K_SM_IDLE 0x00004000 /* Keyboard is idle */
  255. #define KM_CSR_M_SM_IDLE 0x00008000 /* Mouse is idle */
  256. #define KM_CSR_K_TO 0x00010000 /* Keyboard trying to send/receive */
  257. #define KM_CSR_M_TO 0x00020000 /* Mouse trying to send/receive */
  258. #define KM_CSR_K_TO_EN 0x00040000 /* KM_CSR_K_TO + KM_CSR_K_TO_EN = cause
  259. SIO_IR to assert */
  260. #define KM_CSR_M_TO_EN 0x00080000 /* KM_CSR_M_TO + KM_CSR_M_TO_EN = cause
  261. SIO_IR to assert */
  262. #define KM_CSR_K_CLAMP_ONE 0x00100000 /* Pull K_CLK low after rec. one char */
  263. #define KM_CSR_M_CLAMP_ONE 0x00200000 /* Pull M_CLK low after rec. one char */
  264. #define KM_CSR_K_CLAMP_THREE 0x00400000 /* Pull K_CLK low after rec. three chars */
  265. #define KM_CSR_M_CLAMP_THREE 0x00800000 /* Pull M_CLK low after rec. three char */
  266. /* bitmasks for IOC3_K_RD and IOC3_M_RD */
  267. #define KM_RD_DATA_2 0x000000ff /* 3rd char recvd since last read */
  268. #define KM_RD_DATA_2_SHIFT 0
  269. #define KM_RD_DATA_1 0x0000ff00 /* 2nd char recvd since last read */
  270. #define KM_RD_DATA_1_SHIFT 8
  271. #define KM_RD_DATA_0 0x00ff0000 /* 1st char recvd since last read */
  272. #define KM_RD_DATA_0_SHIFT 16
  273. #define KM_RD_FRAME_ERR_2 0x01000000 /* framing or parity error in byte 2 */
  274. #define KM_RD_FRAME_ERR_1 0x02000000 /* same for byte 1 */
  275. #define KM_RD_FRAME_ERR_0 0x04000000 /* same for byte 0 */
  276. #define KM_RD_KBD_MSE 0x08000000 /* 0 if from kbd, 1 if from mouse */
  277. #define KM_RD_OFLO 0x10000000 /* 4th char recvd before this read */
  278. #define KM_RD_VALID_2 0x20000000 /* DATA_2 valid */
  279. #define KM_RD_VALID_1 0x40000000 /* DATA_1 valid */
  280. #define KM_RD_VALID_0 0x80000000 /* DATA_0 valid */
  281. #define KM_RD_VALID_ALL (KM_RD_VALID_0|KM_RD_VALID_1|KM_RD_VALID_2)
  282. /* bitmasks for IOC3_K_WD & IOC3_M_WD */
  283. #define KM_WD_WRT_DATA 0x000000ff /* write to keyboard/mouse port */
  284. #define KM_WD_WRT_DATA_SHIFT 0
  285. /* bitmasks for serial RX status byte */
  286. #define RXSB_OVERRUN 0x01 /* char(s) lost */
  287. #define RXSB_PAR_ERR 0x02 /* parity error */
  288. #define RXSB_FRAME_ERR 0x04 /* framing error */
  289. #define RXSB_BREAK 0x08 /* break character */
  290. #define RXSB_CTS 0x10 /* state of CTS */
  291. #define RXSB_DCD 0x20 /* state of DCD */
  292. #define RXSB_MODEM_VALID 0x40 /* DCD, CTS and OVERRUN are valid */
  293. #define RXSB_DATA_VALID 0x80 /* data byte, FRAME_ERR PAR_ERR & BREAK valid */
  294. /* bitmasks for serial TX control byte */
  295. #define TXCB_INT_WHEN_DONE 0x20 /* interrupt after this byte is sent */
  296. #define TXCB_INVALID 0x00 /* byte is invalid */
  297. #define TXCB_VALID 0x40 /* byte is valid */
  298. #define TXCB_MCR 0x80 /* data<7:0> to modem control register */
  299. #define TXCB_DELAY 0xc0 /* delay data<7:0> mSec */
  300. /* bitmasks for IOC3_SBBR_L */
  301. #define SBBR_L_SIZE 0x00000001 /* 0 == 1KB rings, 1 == 4KB rings */
  302. #define SBBR_L_BASE 0xfffff000 /* lower serial ring base addr */
  303. /* bitmasks for IOC3_SSCR_<A:B> */
  304. #define SSCR_RX_THRESHOLD 0x000001ff /* hiwater mark */
  305. #define SSCR_TX_TIMER_BUSY 0x00010000 /* TX timer in progress */
  306. #define SSCR_HFC_EN 0x00020000 /* hardware flow control enabled */
  307. #define SSCR_RX_RING_DCD 0x00040000 /* post RX record on delta-DCD */
  308. #define SSCR_RX_RING_CTS 0x00080000 /* post RX record on delta-CTS */
  309. #define SSCR_HIGH_SPD 0x00100000 /* 4X speed */
  310. #define SSCR_DIAG 0x00200000 /* bypass clock divider for sim */
  311. #define SSCR_RX_DRAIN 0x08000000 /* drain RX buffer to memory */
  312. #define SSCR_DMA_EN 0x10000000 /* enable ring buffer DMA */
  313. #define SSCR_DMA_PAUSE 0x20000000 /* pause DMA */
  314. #define SSCR_PAUSE_STATE 0x40000000 /* sets when PAUSE takes effect */
  315. #define SSCR_RESET 0x80000000 /* reset DMA channels */
  316. /* all producer/consumer pointers are the same bitfield */
  317. #define PROD_CONS_PTR_4K 0x00000ff8 /* for 4K buffers */
  318. #define PROD_CONS_PTR_1K 0x000003f8 /* for 1K buffers */
  319. #define PROD_CONS_PTR_OFF 3
  320. /* bitmasks for IOC3_SRCIR_<A:B> */
  321. #define SRCIR_ARM 0x80000000 /* arm RX timer */
  322. /* bitmasks for IOC3_SRPIR_<A:B> */
  323. #define SRPIR_BYTE_CNT 0x07000000 /* bytes in packer */
  324. #define SRPIR_BYTE_CNT_SHIFT 24
  325. /* bitmasks for IOC3_STCIR_<A:B> */
  326. #define STCIR_BYTE_CNT 0x0f000000 /* bytes in unpacker */
  327. #define STCIR_BYTE_CNT_SHIFT 24
  328. /* bitmasks for IOC3_SHADOW_<A:B> */
  329. #define SHADOW_DR 0x00000001 /* data ready */
  330. #define SHADOW_OE 0x00000002 /* overrun error */
  331. #define SHADOW_PE 0x00000004 /* parity error */
  332. #define SHADOW_FE 0x00000008 /* framing error */
  333. #define SHADOW_BI 0x00000010 /* break interrupt */
  334. #define SHADOW_THRE 0x00000020 /* transmit holding register empty */
  335. #define SHADOW_TEMT 0x00000040 /* transmit shift register empty */
  336. #define SHADOW_RFCE 0x00000080 /* char in RX fifo has an error */
  337. #define SHADOW_DCTS 0x00010000 /* delta clear to send */
  338. #define SHADOW_DDCD 0x00080000 /* delta data carrier detect */
  339. #define SHADOW_CTS 0x00100000 /* clear to send */
  340. #define SHADOW_DCD 0x00800000 /* data carrier detect */
  341. #define SHADOW_DTR 0x01000000 /* data terminal ready */
  342. #define SHADOW_RTS 0x02000000 /* request to send */
  343. #define SHADOW_OUT1 0x04000000 /* 16550 OUT1 bit */
  344. #define SHADOW_OUT2 0x08000000 /* 16550 OUT2 bit */
  345. #define SHADOW_LOOP 0x10000000 /* loopback enabled */
  346. /* bitmasks for IOC3_SRTR_<A:B> */
  347. #define SRTR_CNT 0x00000fff /* reload value for RX timer */
  348. #define SRTR_CNT_VAL 0x0fff0000 /* current value of RX timer */
  349. #define SRTR_CNT_VAL_SHIFT 16
  350. #define SRTR_HZ 16000 /* SRTR clock frequency */
  351. /* bitmasks for IOC3_SIO_IR, IOC3_SIO_IEC and IOC3_SIO_IES */
  352. #define SIO_IR_SA_TX_MT 0x00000001 /* Serial port A TX empty */
  353. #define SIO_IR_SA_RX_FULL 0x00000002 /* port A RX buf full */
  354. #define SIO_IR_SA_RX_HIGH 0x00000004 /* port A RX hiwat */
  355. #define SIO_IR_SA_RX_TIMER 0x00000008 /* port A RX timeout */
  356. #define SIO_IR_SA_DELTA_DCD 0x00000010 /* port A delta DCD */
  357. #define SIO_IR_SA_DELTA_CTS 0x00000020 /* port A delta CTS */
  358. #define SIO_IR_SA_INT 0x00000040 /* port A pass-thru intr */
  359. #define SIO_IR_SA_TX_EXPLICIT 0x00000080 /* port A explicit TX thru */
  360. #define SIO_IR_SA_MEMERR 0x00000100 /* port A PCI error */
  361. #define SIO_IR_SB_TX_MT 0x00000200 /* */
  362. #define SIO_IR_SB_RX_FULL 0x00000400 /* */
  363. #define SIO_IR_SB_RX_HIGH 0x00000800 /* */
  364. #define SIO_IR_SB_RX_TIMER 0x00001000 /* */
  365. #define SIO_IR_SB_DELTA_DCD 0x00002000 /* */
  366. #define SIO_IR_SB_DELTA_CTS 0x00004000 /* */
  367. #define SIO_IR_SB_INT 0x00008000 /* */
  368. #define SIO_IR_SB_TX_EXPLICIT 0x00010000 /* */
  369. #define SIO_IR_SB_MEMERR 0x00020000 /* */
  370. #define SIO_IR_PP_INT 0x00040000 /* P port pass-thru intr */
  371. #define SIO_IR_PP_INTA 0x00080000 /* PP context A thru */
  372. #define SIO_IR_PP_INTB 0x00100000 /* PP context B thru */
  373. #define SIO_IR_PP_MEMERR 0x00200000 /* PP PCI error */
  374. #define SIO_IR_KBD_INT 0x00400000 /* kbd/mouse intr */
  375. #define SIO_IR_RT_INT 0x08000000 /* RT output pulse */
  376. #define SIO_IR_GEN_INT1 0x10000000 /* RT input pulse */
  377. #define SIO_IR_GEN_INT_SHIFT 28
  378. /* per device interrupt masks */
  379. #define SIO_IR_SA (SIO_IR_SA_TX_MT | SIO_IR_SA_RX_FULL | \
  380. SIO_IR_SA_RX_HIGH | SIO_IR_SA_RX_TIMER | \
  381. SIO_IR_SA_DELTA_DCD | SIO_IR_SA_DELTA_CTS | \
  382. SIO_IR_SA_INT | SIO_IR_SA_TX_EXPLICIT | \
  383. SIO_IR_SA_MEMERR)
  384. #define SIO_IR_SB (SIO_IR_SB_TX_MT | SIO_IR_SB_RX_FULL | \
  385. SIO_IR_SB_RX_HIGH | SIO_IR_SB_RX_TIMER | \
  386. SIO_IR_SB_DELTA_DCD | SIO_IR_SB_DELTA_CTS | \
  387. SIO_IR_SB_INT | SIO_IR_SB_TX_EXPLICIT | \
  388. SIO_IR_SB_MEMERR)
  389. #define SIO_IR_PP (SIO_IR_PP_INT | SIO_IR_PP_INTA | \
  390. SIO_IR_PP_INTB | SIO_IR_PP_MEMERR)
  391. #define SIO_IR_RT (SIO_IR_RT_INT | SIO_IR_GEN_INT1)
  392. /* macro to load pending interrupts */
  393. #define IOC3_PENDING_INTRS(mem) (PCI_INW(&((mem)->sio_ir)) & \
  394. PCI_INW(&((mem)->sio_ies_ro)))
  395. /* bitmasks for SIO_CR */
  396. #define SIO_CR_SIO_RESET 0x00000001 /* reset the SIO */
  397. #define SIO_CR_SER_A_BASE 0x000000fe /* DMA poll addr port A */
  398. #define SIO_CR_SER_A_BASE_SHIFT 1
  399. #define SIO_CR_SER_B_BASE 0x00007f00 /* DMA poll addr port B */
  400. #define SIO_CR_SER_B_BASE_SHIFT 8
  401. #define SIO_SR_CMD_PULSE 0x00078000 /* byte bus strobe length */
  402. #define SIO_CR_CMD_PULSE_SHIFT 15
  403. #define SIO_CR_ARB_DIAG 0x00380000 /* cur !enet PCI requet (ro) */
  404. #define SIO_CR_ARB_DIAG_TXA 0x00000000
  405. #define SIO_CR_ARB_DIAG_RXA 0x00080000
  406. #define SIO_CR_ARB_DIAG_TXB 0x00100000
  407. #define SIO_CR_ARB_DIAG_RXB 0x00180000
  408. #define SIO_CR_ARB_DIAG_PP 0x00200000
  409. #define SIO_CR_ARB_DIAG_IDLE 0x00400000 /* 0 -> active request (ro) */
  410. /* bitmasks for INT_OUT */
  411. #define INT_OUT_COUNT 0x0000ffff /* pulse interval timer */
  412. #define INT_OUT_MODE 0x00070000 /* mode mask */
  413. #define INT_OUT_MODE_0 0x00000000 /* set output to 0 */
  414. #define INT_OUT_MODE_1 0x00040000 /* set output to 1 */
  415. #define INT_OUT_MODE_1PULSE 0x00050000 /* send 1 pulse */
  416. #define INT_OUT_MODE_PULSES 0x00060000 /* send 1 pulse every interval */
  417. #define INT_OUT_MODE_SQW 0x00070000 /* toggle output every interval */
  418. #define INT_OUT_DIAG 0x40000000 /* diag mode */
  419. #define INT_OUT_INT_OUT 0x80000000 /* current state of INT_OUT */
  420. /* time constants for INT_OUT */
  421. #define INT_OUT_NS_PER_TICK (30 * 260) /* 30 ns PCI clock, divisor=260 */
  422. #define INT_OUT_TICKS_PER_PULSE 3 /* outgoing pulse lasts 3 ticks */
  423. #define INT_OUT_US_TO_COUNT(x) /* convert uS to a count value */ \
  424. (((x) * 10 + INT_OUT_NS_PER_TICK / 200) * \
  425. 100 / INT_OUT_NS_PER_TICK - 1)
  426. #define INT_OUT_COUNT_TO_US(x) /* convert count value to uS */ \
  427. (((x) + 1) * INT_OUT_NS_PER_TICK / 1000)
  428. #define INT_OUT_MIN_TICKS 3 /* min period is width of pulse in "ticks" */
  429. #define INT_OUT_MAX_TICKS INT_OUT_COUNT /* largest possible count */
  430. /* bitmasks for GPCR */
  431. #define GPCR_DIR 0x000000ff /* tristate pin input or output */
  432. #define GPCR_DIR_PIN(x) (1<<(x)) /* access one of the DIR bits */
  433. #define GPCR_EDGE 0x000f0000 /* extint edge or level sensitive */
  434. #define GPCR_EDGE_PIN(x) (1<<((x)+15)) /* access one of the EDGE bits */
  435. /* values for GPCR */
  436. #define GPCR_INT_OUT_EN 0x00100000 /* enable INT_OUT to pin 0 */
  437. #define GPCR_MLAN_EN 0x00200000 /* enable MCR to pin 8 */
  438. #define GPCR_DIR_SERA_XCVR 0x00000080 /* Port A Transceiver select enable */
  439. #define GPCR_DIR_SERB_XCVR 0x00000040 /* Port B Transceiver select enable */
  440. #define GPCR_DIR_PHY_RST 0x00000020 /* ethernet PHY reset enable */
  441. /* defs for some of the generic I/O pins */
  442. #define GPCR_PHY_RESET 0x20 /* pin is output to PHY reset */
  443. #define GPCR_UARTB_MODESEL 0x40 /* pin is output to port B mode sel */
  444. #define GPCR_UARTA_MODESEL 0x80 /* pin is output to port A mode sel */
  445. #define GPPR_PHY_RESET_PIN 5 /* GIO pin controlling phy reset */
  446. #define GPPR_UARTB_MODESEL_PIN 6 /* GIO pin controlling uart b mode select */
  447. #define GPPR_UARTA_MODESEL_PIN 7 /* GIO pin controlling uart a mode select */
  448. #define EMCR_DUPLEX 0x00000001
  449. #define EMCR_PROMISC 0x00000002
  450. #define EMCR_PADEN 0x00000004
  451. #define EMCR_RXOFF_MASK 0x000001f8
  452. #define EMCR_RXOFF_SHIFT 3
  453. #define EMCR_RAMPAR 0x00000200
  454. #define EMCR_BADPAR 0x00000800
  455. #define EMCR_BUFSIZ 0x00001000
  456. #define EMCR_TXDMAEN 0x00002000
  457. #define EMCR_TXEN 0x00004000
  458. #define EMCR_RXDMAEN 0x00008000
  459. #define EMCR_RXEN 0x00010000
  460. #define EMCR_LOOPBACK 0x00020000
  461. #define EMCR_ARB_DIAG 0x001c0000
  462. #define EMCR_ARB_DIAG_IDLE 0x00200000
  463. #define EMCR_RST 0x80000000
  464. #define EISR_RXTIMERINT 0x00000001
  465. #define EISR_RXTHRESHINT 0x00000002
  466. #define EISR_RXOFLO 0x00000004
  467. #define EISR_RXBUFOFLO 0x00000008
  468. #define EISR_RXMEMERR 0x00000010
  469. #define EISR_RXPARERR 0x00000020
  470. #define EISR_TXEMPTY 0x00010000
  471. #define EISR_TXRTRY 0x00020000
  472. #define EISR_TXEXDEF 0x00040000
  473. #define EISR_TXLCOL 0x00080000
  474. #define EISR_TXGIANT 0x00100000
  475. #define EISR_TXBUFUFLO 0x00200000
  476. #define EISR_TXEXPLICIT 0x00400000
  477. #define EISR_TXCOLLWRAP 0x00800000
  478. #define EISR_TXDEFERWRAP 0x01000000
  479. #define EISR_TXMEMERR 0x02000000
  480. #define EISR_TXPARERR 0x04000000
  481. #define ERCSR_THRESH_MASK 0x000001ff /* enet RX threshold */
  482. #define ERCSR_RX_TMR 0x40000000 /* simulation only */
  483. #define ERCSR_DIAG_OFLO 0x80000000 /* simulation only */
  484. #define ERBR_ALIGNMENT 4096
  485. #define ERBR_L_RXRINGBASE_MASK 0xfffff000
  486. #define ERBAR_BARRIER_BIT 0x0100
  487. #define ERBAR_RXBARR_MASK 0xffff0000
  488. #define ERBAR_RXBARR_SHIFT 16
  489. #define ERCIR_RXCONSUME_MASK 0x00000fff
  490. #define ERPIR_RXPRODUCE_MASK 0x00000fff
  491. #define ERPIR_ARM 0x80000000
  492. #define ERTR_CNT_MASK 0x000007ff
  493. #define ETCSR_IPGT_MASK 0x0000007f
  494. #define ETCSR_IPGR1_MASK 0x00007f00
  495. #define ETCSR_IPGR1_SHIFT 8
  496. #define ETCSR_IPGR2_MASK 0x007f0000
  497. #define ETCSR_IPGR2_SHIFT 16
  498. #define ETCSR_NOTXCLK 0x80000000
  499. #define ETCDC_COLLCNT_MASK 0x0000ffff
  500. #define ETCDC_DEFERCNT_MASK 0xffff0000
  501. #define ETCDC_DEFERCNT_SHIFT 16
  502. #define ETBR_ALIGNMENT (64*1024)
  503. #define ETBR_L_RINGSZ_MASK 0x00000001
  504. #define ETBR_L_RINGSZ128 0
  505. #define ETBR_L_RINGSZ512 1
  506. #define ETBR_L_TXRINGBASE_MASK 0xffffc000
  507. #define ETCIR_TXCONSUME_MASK 0x0000ffff
  508. #define ETCIR_IDLE 0x80000000
  509. #define ETPIR_TXPRODUCE_MASK 0x0000ffff
  510. #define EBIR_TXBUFPROD_MASK 0x0000001f
  511. #define EBIR_TXBUFCONS_MASK 0x00001f00
  512. #define EBIR_TXBUFCONS_SHIFT 8
  513. #define EBIR_RXBUFPROD_MASK 0x007fc000
  514. #define EBIR_RXBUFPROD_SHIFT 14
  515. #define EBIR_RXBUFCONS_MASK 0xff800000
  516. #define EBIR_RXBUFCONS_SHIFT 23
  517. #define MICR_REGADDR_MASK 0x0000001f
  518. #define MICR_PHYADDR_MASK 0x000003e0
  519. #define MICR_PHYADDR_SHIFT 5
  520. #define MICR_READTRIG 0x00000400
  521. #define MICR_BUSY 0x00000800
  522. #define MIDR_DATA_MASK 0x0000ffff
  523. #define ERXBUF_IPCKSUM_MASK 0x0000ffff
  524. #define ERXBUF_BYTECNT_MASK 0x07ff0000
  525. #define ERXBUF_BYTECNT_SHIFT 16
  526. #define ERXBUF_V 0x80000000
  527. #define ERXBUF_CRCERR 0x00000001 /* aka RSV15 */
  528. #define ERXBUF_FRAMERR 0x00000002 /* aka RSV14 */
  529. #define ERXBUF_CODERR 0x00000004 /* aka RSV13 */
  530. #define ERXBUF_INVPREAMB 0x00000008 /* aka RSV18 */
  531. #define ERXBUF_LOLEN 0x00007000 /* aka RSV2_0 */
  532. #define ERXBUF_HILEN 0x03ff0000 /* aka RSV12_3 */
  533. #define ERXBUF_MULTICAST 0x04000000 /* aka RSV16 */
  534. #define ERXBUF_BROADCAST 0x08000000 /* aka RSV17 */
  535. #define ERXBUF_LONGEVENT 0x10000000 /* aka RSV19 */
  536. #define ERXBUF_BADPKT 0x20000000 /* aka RSV20 */
  537. #define ERXBUF_GOODPKT 0x40000000 /* aka RSV21 */
  538. #define ERXBUF_CARRIER 0x80000000 /* aka RSV22 */
  539. #define ETXD_BYTECNT_MASK 0x000007ff /* total byte count */
  540. #define ETXD_INTWHENDONE 0x00001000 /* intr when done */
  541. #define ETXD_D0V 0x00010000 /* data 0 valid */
  542. #define ETXD_B1V 0x00020000 /* buf 1 valid */
  543. #define ETXD_B2V 0x00040000 /* buf 2 valid */
  544. #define ETXD_DOCHECKSUM 0x00080000 /* insert ip cksum */
  545. #define ETXD_CHKOFF_MASK 0x07f00000 /* cksum byte offset */
  546. #define ETXD_CHKOFF_SHIFT 20
  547. #define ETXD_D0CNT_MASK 0x0000007f
  548. #define ETXD_B1CNT_MASK 0x0007ff00
  549. #define ETXD_B1CNT_SHIFT 8
  550. #define ETXD_B2CNT_MASK 0x7ff00000
  551. #define ETXD_B2CNT_SHIFT 20
  552. typedef enum ioc3_subdevs_e {
  553. ioc3_subdev_ether,
  554. ioc3_subdev_generic,
  555. ioc3_subdev_nic,
  556. ioc3_subdev_kbms,
  557. ioc3_subdev_ttya,
  558. ioc3_subdev_ttyb,
  559. ioc3_subdev_ecpp,
  560. ioc3_subdev_rt,
  561. ioc3_nsubdevs
  562. } ioc3_subdev_t;
  563. /* subdevice disable bits,
  564. * from the standard INFO_LBL_SUBDEVS
  565. */
  566. #define IOC3_SDB_ETHER (1<<ioc3_subdev_ether)
  567. #define IOC3_SDB_GENERIC (1<<ioc3_subdev_generic)
  568. #define IOC3_SDB_NIC (1<<ioc3_subdev_nic)
  569. #define IOC3_SDB_KBMS (1<<ioc3_subdev_kbms)
  570. #define IOC3_SDB_TTYA (1<<ioc3_subdev_ttya)
  571. #define IOC3_SDB_TTYB (1<<ioc3_subdev_ttyb)
  572. #define IOC3_SDB_ECPP (1<<ioc3_subdev_ecpp)
  573. #define IOC3_SDB_RT (1<<ioc3_subdev_rt)
  574. #define IOC3_ALL_SUBDEVS ((1<<ioc3_nsubdevs)-1)
  575. #define IOC3_SDB_SERIAL (IOC3_SDB_TTYA|IOC3_SDB_TTYB)
  576. #define IOC3_STD_SUBDEVS IOC3_ALL_SUBDEVS
  577. #define IOC3_INTA_SUBDEVS IOC3_SDB_ETHER
  578. #define IOC3_INTB_SUBDEVS (IOC3_SDB_GENERIC|IOC3_SDB_KBMS|IOC3_SDB_SERIAL|IOC3_SDB_ECPP|IOC3_SDB_RT)
  579. #endif /* _IOC3_H */