mace.h 10 KB

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