ioc.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * ioc.h: Definitions for SGI I/O Controller
  7. *
  8. * Copyright (C) 1996 David S. Miller
  9. * Copyright (C) 1997, 1998, 1999, 2000 Ralf Baechle
  10. * Copyright (C) 2001, 2003 Ladislav Michl
  11. */
  12. #ifndef _SGI_IOC_H
  13. #define _SGI_IOC_H
  14. #include <linux/types.h>
  15. #include <asm/sgi/pi1.h>
  16. /*
  17. * All registers are 8-bit wide aligned on 32-bit boundary. Bad things
  18. * happen if you try word access them. You have been warned.
  19. */
  20. struct sgioc_uart_regs {
  21. u8 _ctrl1[3];
  22. volatile u8 ctrl1;
  23. u8 _data1[3];
  24. volatile u8 data1;
  25. u8 _ctrl2[3];
  26. volatile u8 ctrl2;
  27. u8 _data2[3];
  28. volatile u8 data2;
  29. };
  30. struct sgioc_keyb_regs {
  31. u8 _data[3];
  32. volatile u8 data;
  33. u8 _command[3];
  34. volatile u8 command;
  35. };
  36. struct sgint_regs {
  37. u8 _istat0[3];
  38. volatile u8 istat0; /* Interrupt status zero */
  39. #define SGINT_ISTAT0_FFULL 0x01
  40. #define SGINT_ISTAT0_SCSI0 0x02
  41. #define SGINT_ISTAT0_SCSI1 0x04
  42. #define SGINT_ISTAT0_ENET 0x08
  43. #define SGINT_ISTAT0_GFXDMA 0x10
  44. #define SGINT_ISTAT0_PPORT 0x20
  45. #define SGINT_ISTAT0_HPC2 0x40
  46. #define SGINT_ISTAT0_LIO2 0x80
  47. u8 _imask0[3];
  48. volatile u8 imask0; /* Interrupt mask zero */
  49. u8 _istat1[3];
  50. volatile u8 istat1; /* Interrupt status one */
  51. #define SGINT_ISTAT1_ISDNI 0x01
  52. #define SGINT_ISTAT1_PWR 0x02
  53. #define SGINT_ISTAT1_ISDNH 0x04
  54. #define SGINT_ISTAT1_LIO3 0x08
  55. #define SGINT_ISTAT1_HPC3 0x10
  56. #define SGINT_ISTAT1_AFAIL 0x20
  57. #define SGINT_ISTAT1_VIDEO 0x40
  58. #define SGINT_ISTAT1_GIO2 0x80
  59. u8 _imask1[3];
  60. volatile u8 imask1; /* Interrupt mask one */
  61. u8 _vmeistat[3];
  62. volatile u8 vmeistat; /* VME interrupt status */
  63. u8 _cmeimask0[3];
  64. volatile u8 cmeimask0; /* VME interrupt mask zero */
  65. u8 _cmeimask1[3];
  66. volatile u8 cmeimask1; /* VME interrupt mask one */
  67. u8 _cmepol[3];
  68. volatile u8 cmepol; /* VME polarity */
  69. u8 _tclear[3];
  70. volatile u8 tclear;
  71. u8 _errstat[3];
  72. volatile u8 errstat; /* Error status reg, reserved on INT2 */
  73. u32 _unused0[2];
  74. u8 _tcnt0[3];
  75. volatile u8 tcnt0; /* counter 0 */
  76. u8 _tcnt1[3];
  77. volatile u8 tcnt1; /* counter 1 */
  78. u8 _tcnt2[3];
  79. volatile u8 tcnt2; /* counter 2 */
  80. u8 _tcword[3];
  81. volatile u8 tcword; /* control word */
  82. #define SGINT_TCWORD_BCD 0x01 /* Use BCD mode for counters */
  83. #define SGINT_TCWORD_MMASK 0x0e /* Mode bitmask. */
  84. #define SGINT_TCWORD_MITC 0x00 /* IRQ on terminal count (doesn't work) */
  85. #define SGINT_TCWORD_MOS 0x02 /* One-shot IRQ mode. */
  86. #define SGINT_TCWORD_MRGEN 0x04 /* Normal rate generation */
  87. #define SGINT_TCWORD_MSWGEN 0x06 /* Square wave generator mode */
  88. #define SGINT_TCWORD_MSWST 0x08 /* Software strobe */
  89. #define SGINT_TCWORD_MHWST 0x0a /* Hardware strobe */
  90. #define SGINT_TCWORD_CMASK 0x30 /* Command mask */
  91. #define SGINT_TCWORD_CLAT 0x00 /* Latch command */
  92. #define SGINT_TCWORD_CLSB 0x10 /* LSB read/write */
  93. #define SGINT_TCWORD_CMSB 0x20 /* MSB read/write */
  94. #define SGINT_TCWORD_CALL 0x30 /* Full counter read/write */
  95. #define SGINT_TCWORD_CNT0 0x00 /* Select counter zero */
  96. #define SGINT_TCWORD_CNT1 0x40 /* Select counter one */
  97. #define SGINT_TCWORD_CNT2 0x80 /* Select counter two */
  98. #define SGINT_TCWORD_CRBCK 0xc0 /* Readback command */
  99. };
  100. /*
  101. * The timer is the good old 8254. Unlike in PCs it's clocked at exactly 1MHz
  102. */
  103. #define SGINT_TIMER_CLOCK 1000000
  104. /*
  105. * This is the constant we're using for calibrating the counter.
  106. */
  107. #define SGINT_TCSAMP_COUNTER ((SGINT_TIMER_CLOCK / HZ) + 255)
  108. /* We need software copies of these because they are write only. */
  109. extern u8 sgi_ioc_reset, sgi_ioc_write;
  110. struct sgioc_regs {
  111. struct pi1_regs pport;
  112. u32 _unused0[2];
  113. struct sgioc_uart_regs uart;
  114. struct sgioc_keyb_regs kbdmouse;
  115. u8 _gcsel[3];
  116. volatile u8 gcsel;
  117. u8 _genctrl[3];
  118. volatile u8 genctrl;
  119. u8 _panel[3];
  120. volatile u8 panel;
  121. #define SGIOC_PANEL_POWERON 0x01
  122. #define SGIOC_PANEL_POWERINTR 0x02
  123. #define SGIOC_PANEL_VOLDNINTR 0x10
  124. #define SGIOC_PANEL_VOLDNHOLD 0x20
  125. #define SGIOC_PANEL_VOLUPINTR 0x40
  126. #define SGIOC_PANEL_VOLUPHOLD 0x80
  127. u32 _unused1;
  128. u8 _sysid[3];
  129. volatile u8 sysid;
  130. #define SGIOC_SYSID_FULLHOUSE 0x01
  131. #define SGIOC_SYSID_BOARDREV(x) (((x) & 0x1e) >> 1)
  132. #define SGIOC_SYSID_CHIPREV(x) (((x) & 0xe0) >> 5)
  133. u32 _unused2;
  134. u8 _read[3];
  135. volatile u8 read;
  136. u32 _unused3;
  137. u8 _dmasel[3];
  138. volatile u8 dmasel;
  139. #define SGIOC_DMASEL_SCLK10MHZ 0x00 /* use 10MHZ serial clock */
  140. #define SGIOC_DMASEL_ISDNB 0x01 /* enable isdn B */
  141. #define SGIOC_DMASEL_ISDNA 0x02 /* enable isdn A */
  142. #define SGIOC_DMASEL_PPORT 0x04 /* use parallel DMA */
  143. #define SGIOC_DMASEL_SCLK667MHZ 0x10 /* use 6.67MHZ serial clock */
  144. #define SGIOC_DMASEL_SCLKEXT 0x20 /* use external serial clock */
  145. u32 _unused4;
  146. u8 _reset[3];
  147. volatile u8 reset;
  148. #define SGIOC_RESET_PPORT 0x01 /* 0=parport reset, 1=nornal */
  149. #define SGIOC_RESET_KBDMOUSE 0x02 /* 0=kbdmouse reset, 1=normal */
  150. #define SGIOC_RESET_EISA 0x04 /* 0=eisa reset, 1=normal */
  151. #define SGIOC_RESET_ISDN 0x08 /* 0=isdn reset, 1=normal */
  152. #define SGIOC_RESET_LC0OFF 0x10 /* guiness: turn led off (red, else green) */
  153. #define SGIOC_RESET_LC1OFF 0x20 /* guiness: turn led off (green, else amber) */
  154. u32 _unused5;
  155. u8 _write[3];
  156. volatile u8 write;
  157. #define SGIOC_WRITE_NTHRESH 0x01 /* use 4.5db threshold */
  158. #define SGIOC_WRITE_TPSPEED 0x02 /* use 100ohm TP speed */
  159. #define SGIOC_WRITE_EPSEL 0x04 /* force cable mode: 1=AUI 0=TP */
  160. #define SGIOC_WRITE_EASEL 0x08 /* 1=autoselect 0=manual cable selection */
  161. #define SGIOC_WRITE_U1AMODE 0x10 /* 1=PC 0=MAC UART mode */
  162. #define SGIOC_WRITE_U0AMODE 0x20 /* 1=PC 0=MAC UART mode */
  163. #define SGIOC_WRITE_MLO 0x40 /* 1=4.75V 0=+5V */
  164. #define SGIOC_WRITE_MHI 0x80 /* 1=5.25V 0=+5V */
  165. u32 _unused6;
  166. struct sgint_regs int3;
  167. u32 _unused7[16];
  168. volatile u32 extio; /* FullHouse only */
  169. #define EXTIO_S0_IRQ_3 0x8000 /* S0: vid.vsync */
  170. #define EXTIO_S0_IRQ_2 0x4000 /* S0: gfx.fifofull */
  171. #define EXTIO_S0_IRQ_1 0x2000 /* S0: gfx.int */
  172. #define EXTIO_S0_RETRACE 0x1000
  173. #define EXTIO_SG_IRQ_3 0x0800 /* SG: vid.vsync */
  174. #define EXTIO_SG_IRQ_2 0x0400 /* SG: gfx.fifofull */
  175. #define EXTIO_SG_IRQ_1 0x0200 /* SG: gfx.int */
  176. #define EXTIO_SG_RETRACE 0x0100
  177. #define EXTIO_GIO_33MHZ 0x0080
  178. #define EXTIO_EISA_BUSERR 0x0040
  179. #define EXTIO_MC_BUSERR 0x0020
  180. #define EXTIO_HPC3_BUSERR 0x0010
  181. #define EXTIO_S0_STAT_1 0x0008
  182. #define EXTIO_S0_STAT_0 0x0004
  183. #define EXTIO_SG_STAT_1 0x0002
  184. #define EXTIO_SG_STAT_0 0x0001
  185. };
  186. extern struct sgioc_regs *sgioc;
  187. extern struct sgint_regs *sgint;
  188. #endif