mace.h 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. /*
  2. * Definitions for the SGI MACE (Multimedia, Audio and Communications Engine)
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. *
  8. * Copyright (C) 2000 Harald Koerfgen
  9. * Copyright (C) 2004 Ladislav Michl
  10. */
  11. #ifndef __ASM_MACE_H__
  12. #define __ASM_MACE_H__
  13. /*
  14. * Address map
  15. */
  16. #define MACE_BASE 0x1f000000 /* physical */
  17. #undef BIT
  18. #define BIT(x) (1UL << (x))
  19. /*
  20. * PCI interface
  21. */
  22. struct mace_pci {
  23. volatile unsigned int error_addr;
  24. volatile unsigned int error;
  25. #define MACEPCI_ERROR_MASTER_ABORT BIT(31)
  26. #define MACEPCI_ERROR_TARGET_ABORT BIT(30)
  27. #define MACEPCI_ERROR_DATA_PARITY_ERR BIT(29)
  28. #define MACEPCI_ERROR_RETRY_ERR BIT(28)
  29. #define MACEPCI_ERROR_ILLEGAL_CMD BIT(27)
  30. #define MACEPCI_ERROR_SYSTEM_ERR BIT(26)
  31. #define MACEPCI_ERROR_INTERRUPT_TEST BIT(25)
  32. #define MACEPCI_ERROR_PARITY_ERR BIT(24)
  33. #define MACEPCI_ERROR_OVERRUN BIT(23)
  34. #define MACEPCI_ERROR_RSVD BIT(22)
  35. #define MACEPCI_ERROR_MEMORY_ADDR BIT(21)
  36. #define MACEPCI_ERROR_CONFIG_ADDR BIT(20)
  37. #define MACEPCI_ERROR_MASTER_ABORT_ADDR_VALID BIT(19)
  38. #define MACEPCI_ERROR_TARGET_ABORT_ADDR_VALID BIT(18)
  39. #define MACEPCI_ERROR_DATA_PARITY_ADDR_VALID BIT(17)
  40. #define MACEPCI_ERROR_RETRY_ADDR_VALID BIT(16)
  41. #define MACEPCI_ERROR_SIG_TABORT BIT(4)
  42. #define MACEPCI_ERROR_DEVSEL_MASK 0xc0
  43. #define MACEPCI_ERROR_DEVSEL_FAST 0
  44. #define MACEPCI_ERROR_DEVSEL_MED 0x40
  45. #define MACEPCI_ERROR_DEVSEL_SLOW 0x80
  46. #define MACEPCI_ERROR_FBB BIT(1)
  47. #define MACEPCI_ERROR_66MHZ BIT(0)
  48. volatile unsigned int control;
  49. #define MACEPCI_CONTROL_INT(x) BIT(x)
  50. #define MACEPCI_CONTROL_INT_MASK 0xff
  51. #define MACEPCI_CONTROL_SERR_ENA BIT(8)
  52. #define MACEPCI_CONTROL_ARB_N6 BIT(9)
  53. #define MACEPCI_CONTROL_PARITY_ERR BIT(10)
  54. #define MACEPCI_CONTROL_MRMRA_ENA BIT(11)
  55. #define MACEPCI_CONTROL_ARB_N3 BIT(12)
  56. #define MACEPCI_CONTROL_ARB_N4 BIT(13)
  57. #define MACEPCI_CONTROL_ARB_N5 BIT(14)
  58. #define MACEPCI_CONTROL_PARK_LIU BIT(15)
  59. #define MACEPCI_CONTROL_INV_INT(x) BIT(16+x)
  60. #define MACEPCI_CONTROL_INV_INT_MASK 0x00ff0000
  61. #define MACEPCI_CONTROL_OVERRUN_INT BIT(24)
  62. #define MACEPCI_CONTROL_PARITY_INT BIT(25)
  63. #define MACEPCI_CONTROL_SERR_INT BIT(26)
  64. #define MACEPCI_CONTROL_IT_INT BIT(27)
  65. #define MACEPCI_CONTROL_RE_INT BIT(28)
  66. #define MACEPCI_CONTROL_DPED_INT BIT(29)
  67. #define MACEPCI_CONTROL_TAR_INT BIT(30)
  68. #define MACEPCI_CONTROL_MAR_INT BIT(31)
  69. volatile unsigned int rev;
  70. unsigned int _pad[0xcf8/4 - 4];
  71. volatile unsigned int config_addr;
  72. union {
  73. volatile unsigned char b[4];
  74. volatile unsigned short w[2];
  75. volatile unsigned int l;
  76. } config_data;
  77. };
  78. #define MACEPCI_LOW_MEMORY 0x1a000000
  79. #define MACEPCI_LOW_IO 0x18000000
  80. #define MACEPCI_SWAPPED_VIEW 0
  81. #define MACEPCI_NATIVE_VIEW 0x40000000
  82. #define MACEPCI_IO 0x80000000
  83. #define MACEPCI_HI_MEMORY 0x280000000
  84. #define MACEPCI_HI_IO 0x100000000
  85. /*
  86. * Video interface
  87. */
  88. struct mace_video {
  89. unsigned long xxx; /* later... */
  90. };
  91. /*
  92. * Ethernet interface
  93. */
  94. struct mace_ethernet {
  95. volatile unsigned long mac_ctrl;
  96. volatile unsigned long int_stat;
  97. volatile unsigned long dma_ctrl;
  98. volatile unsigned long timer;
  99. volatile unsigned long tx_int_al;
  100. volatile unsigned long rx_int_al;
  101. volatile unsigned long tx_info;
  102. volatile unsigned long tx_info_al;
  103. volatile unsigned long rx_buff;
  104. volatile unsigned long rx_buff_al1;
  105. volatile unsigned long rx_buff_al2;
  106. volatile unsigned long diag;
  107. volatile unsigned long phy_data;
  108. volatile unsigned long phy_regs;
  109. volatile unsigned long phy_trans_go;
  110. volatile unsigned long backoff_seed;
  111. /*===================================*/
  112. volatile unsigned long imq_reserved[4];
  113. volatile unsigned long mac_addr;
  114. volatile unsigned long mac_addr2;
  115. volatile unsigned long mcast_filter;
  116. volatile unsigned long tx_ring_base;
  117. /* Following are read-only registers for debugging */
  118. volatile unsigned long tx_pkt1_hdr;
  119. volatile unsigned long tx_pkt1_ptr[3];
  120. volatile unsigned long tx_pkt2_hdr;
  121. volatile unsigned long tx_pkt2_ptr[3];
  122. /*===================================*/
  123. volatile unsigned long rx_fifo;
  124. };
  125. /*
  126. * Peripherals
  127. */
  128. /* Audio registers */
  129. struct mace_audio {
  130. volatile unsigned long control;
  131. volatile unsigned long codec_control; /* codec status control */
  132. volatile unsigned long codec_mask; /* codec status input mask */
  133. volatile unsigned long codec_read; /* codec status read data */
  134. struct {
  135. volatile unsigned long control; /* channel control */
  136. volatile unsigned long read_ptr; /* channel read pointer */
  137. volatile unsigned long write_ptr; /* channel write pointer */
  138. volatile unsigned long depth; /* channel depth */
  139. } chan[3];
  140. };
  141. /* ISA Control and DMA registers */
  142. struct mace_isactrl {
  143. volatile unsigned long ringbase;
  144. #define MACEISA_RINGBUFFERS_SIZE (8 * 4096)
  145. volatile unsigned long misc;
  146. #define MACEISA_FLASH_WE BIT(0) /* 1=> Enable FLASH writes */
  147. #define MACEISA_PWD_CLEAR BIT(1) /* 1=> PWD CLEAR jumper detected */
  148. #define MACEISA_NIC_DEASSERT BIT(2)
  149. #define MACEISA_NIC_DATA BIT(3)
  150. #define MACEISA_LED_RED BIT(4) /* 0=> Illuminate red LED */
  151. #define MACEISA_LED_GREEN BIT(5) /* 0=> Illuminate green LED */
  152. #define MACEISA_DP_RAM_ENABLE BIT(6)
  153. volatile unsigned long istat;
  154. volatile unsigned long imask;
  155. #define MACEISA_AUDIO_SW_INT BIT(0)
  156. #define MACEISA_AUDIO_SC_INT BIT(1)
  157. #define MACEISA_AUDIO1_DMAT_INT BIT(2)
  158. #define MACEISA_AUDIO1_OF_INT BIT(3)
  159. #define MACEISA_AUDIO2_DMAT_INT BIT(4)
  160. #define MACEISA_AUDIO2_MERR_INT BIT(5)
  161. #define MACEISA_AUDIO3_DMAT_INT BIT(6)
  162. #define MACEISA_AUDIO3_MERR_INT BIT(7)
  163. #define MACEISA_RTC_INT BIT(8)
  164. #define MACEISA_KEYB_INT BIT(9)
  165. #define MACEISA_KEYB_POLL_INT BIT(10)
  166. #define MACEISA_MOUSE_INT BIT(11)
  167. #define MACEISA_MOUSE_POLL_INT BIT(12)
  168. #define MACEISA_TIMER0_INT BIT(13)
  169. #define MACEISA_TIMER1_INT BIT(14)
  170. #define MACEISA_TIMER2_INT BIT(15)
  171. #define MACEISA_PARALLEL_INT BIT(16)
  172. #define MACEISA_PAR_CTXA_INT BIT(17)
  173. #define MACEISA_PAR_CTXB_INT BIT(18)
  174. #define MACEISA_PAR_MERR_INT BIT(19)
  175. #define MACEISA_SERIAL1_INT BIT(20)
  176. #define MACEISA_SERIAL1_TDMAT_INT BIT(21)
  177. #define MACEISA_SERIAL1_TDMAPR_INT BIT(22)
  178. #define MACEISA_SERIAL1_TDMAME_INT BIT(23)
  179. #define MACEISA_SERIAL1_RDMAT_INT BIT(24)
  180. #define MACEISA_SERIAL1_RDMAOR_INT BIT(25)
  181. #define MACEISA_SERIAL2_INT BIT(26)
  182. #define MACEISA_SERIAL2_TDMAT_INT BIT(27)
  183. #define MACEISA_SERIAL2_TDMAPR_INT BIT(28)
  184. #define MACEISA_SERIAL2_TDMAME_INT BIT(29)
  185. #define MACEISA_SERIAL2_RDMAT_INT BIT(30)
  186. #define MACEISA_SERIAL2_RDMAOR_INT BIT(31)
  187. volatile unsigned long _pad[0x2000/8 - 4];
  188. volatile unsigned long dp_ram[0x400];
  189. };
  190. /* Keyboard & Mouse registers
  191. * -> drivers/input/serio/maceps2.c */
  192. struct mace_ps2port {
  193. volatile unsigned long tx;
  194. volatile unsigned long rx;
  195. volatile unsigned long control;
  196. volatile unsigned long status;
  197. };
  198. struct mace_ps2 {
  199. struct mace_ps2port keyb;
  200. struct mace_ps2port mouse;
  201. };
  202. /* I2C registers
  203. * -> drivers/i2c/algos/i2c-algo-sgi.c */
  204. struct mace_i2c {
  205. volatile unsigned long config;
  206. #define MACEI2C_RESET BIT(0)
  207. #define MACEI2C_FAST BIT(1)
  208. #define MACEI2C_DATA_OVERRIDE BIT(2)
  209. #define MACEI2C_CLOCK_OVERRIDE BIT(3)
  210. #define MACEI2C_DATA_STATUS BIT(4)
  211. #define MACEI2C_CLOCK_STATUS BIT(5)
  212. volatile unsigned long control;
  213. volatile unsigned long data;
  214. };
  215. /* Timer registers */
  216. typedef union {
  217. volatile unsigned long ust_msc;
  218. struct reg {
  219. volatile unsigned int ust;
  220. volatile unsigned int msc;
  221. } reg;
  222. } timer_reg;
  223. struct mace_timers {
  224. volatile unsigned long ust;
  225. #define MACE_UST_PERIOD_NS 960
  226. volatile unsigned long compare1;
  227. volatile unsigned long compare2;
  228. volatile unsigned long compare3;
  229. timer_reg audio_in;
  230. timer_reg audio_out1;
  231. timer_reg audio_out2;
  232. timer_reg video_in1;
  233. timer_reg video_in2;
  234. timer_reg video_out;
  235. };
  236. struct mace_perif {
  237. struct mace_audio audio;
  238. char _pad0[0x10000 - sizeof(struct mace_audio)];
  239. struct mace_isactrl ctrl;
  240. char _pad1[0x10000 - sizeof(struct mace_isactrl)];
  241. struct mace_ps2 ps2;
  242. char _pad2[0x10000 - sizeof(struct mace_ps2)];
  243. struct mace_i2c i2c;
  244. char _pad3[0x10000 - sizeof(struct mace_i2c)];
  245. struct mace_timers timers;
  246. char _pad4[0x10000 - sizeof(struct mace_timers)];
  247. };
  248. /*
  249. * ISA peripherals
  250. */
  251. /* Parallel port */
  252. struct mace_parallel { /* later... */
  253. };
  254. struct mace_ecp1284 { /* later... */
  255. };
  256. /* Serial port */
  257. struct mace_serial {
  258. volatile unsigned long xxx; /* later... */
  259. };
  260. struct mace_isa {
  261. struct mace_parallel parallel;
  262. char _pad1[0x8000 - sizeof(struct mace_parallel)];
  263. struct mace_ecp1284 ecp1284;
  264. char _pad2[0x8000 - sizeof(struct mace_ecp1284)];
  265. struct mace_serial serial1;
  266. char _pad3[0x8000 - sizeof(struct mace_serial)];
  267. struct mace_serial serial2;
  268. char _pad4[0x8000 - sizeof(struct mace_serial)];
  269. volatile unsigned char rtc[0x10000];
  270. };
  271. struct sgi_mace {
  272. char _reserved[0x80000];
  273. struct mace_pci pci;
  274. char _pad0[0x80000 - sizeof(struct mace_pci)];
  275. struct mace_video video_in1;
  276. char _pad1[0x80000 - sizeof(struct mace_video)];
  277. struct mace_video video_in2;
  278. char _pad2[0x80000 - sizeof(struct mace_video)];
  279. struct mace_video video_out;
  280. char _pad3[0x80000 - sizeof(struct mace_video)];
  281. struct mace_ethernet eth;
  282. char _pad4[0x80000 - sizeof(struct mace_ethernet)];
  283. struct mace_perif perif;
  284. char _pad5[0x80000 - sizeof(struct mace_perif)];
  285. struct mace_isa isa;
  286. char _pad6[0x80000 - sizeof(struct mace_isa)];
  287. };
  288. extern struct sgi_mace *mace;
  289. #endif /* __ASM_MACE_H__ */