jazz.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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. * Copyright (C) 1995 - 1998 by Andreas Busse and Ralf Baechle
  7. */
  8. #ifndef __ASM_JAZZ_H
  9. #define __ASM_JAZZ_H
  10. /*
  11. * The addresses below are virtual address. The mappings are
  12. * created on startup via wired entries in the tlb. The Mips
  13. * Magnum R3000 and R4000 machines are similar in many aspects,
  14. * but many hardware register are accessible at 0xb9000000 in
  15. * instead of 0xe0000000.
  16. */
  17. #define JAZZ_LOCAL_IO_SPACE 0xe0000000
  18. /*
  19. * Revision numbers in PICA_ASIC_REVISION
  20. *
  21. * 0xf0000000 - Rev1
  22. * 0xf0000001 - Rev2
  23. * 0xf0000002 - Rev3
  24. */
  25. #define PICA_ASIC_REVISION 0xe0000008
  26. /*
  27. * The segments of the seven segment LED are mapped
  28. * to the control bits as follows:
  29. *
  30. * (7)
  31. * ---------
  32. * | |
  33. * (2) | | (6)
  34. * | (1) |
  35. * ---------
  36. * | |
  37. * (3) | | (5)
  38. * | (4) |
  39. * --------- . (0)
  40. */
  41. #define PICA_LED 0xe000f000
  42. /*
  43. * Some characters for the LED control registers
  44. * The original Mips machines seem to have a LED display
  45. * with integrated decoder while the Acer machines can
  46. * control each of the seven segments and the dot independently.
  47. * It's only a toy, anyway...
  48. */
  49. #define LED_DOT 0x01
  50. #define LED_SPACE 0x00
  51. #define LED_0 0xfc
  52. #define LED_1 0x60
  53. #define LED_2 0xda
  54. #define LED_3 0xf2
  55. #define LED_4 0x66
  56. #define LED_5 0xb6
  57. #define LED_6 0xbe
  58. #define LED_7 0xe0
  59. #define LED_8 0xfe
  60. #define LED_9 0xf6
  61. #define LED_A 0xee
  62. #define LED_b 0x3e
  63. #define LED_C 0x9c
  64. #define LED_d 0x7a
  65. #define LED_E 0x9e
  66. #define LED_F 0x8e
  67. #ifndef __ASSEMBLY__
  68. static __inline__ void pica_set_led(unsigned int bits)
  69. {
  70. volatile unsigned int *led_register = (unsigned int *) PICA_LED;
  71. *led_register = bits;
  72. }
  73. #endif /* !__ASSEMBLY__ */
  74. /*
  75. * Base address of the Sonic Ethernet adapter in Jazz machines.
  76. */
  77. #define JAZZ_ETHERNET_BASE 0xe0001000
  78. /*
  79. * Base address of the 53C94 SCSI hostadapter in Jazz machines.
  80. */
  81. #define JAZZ_SCSI_BASE 0xe0002000
  82. /*
  83. * i8042 keyboard controller for JAZZ and PICA chipsets.
  84. * This address is just a guess and seems to differ from
  85. * other mips machines such as RC3xxx...
  86. */
  87. #define JAZZ_KEYBOARD_ADDRESS 0xe0005000
  88. #define JAZZ_KEYBOARD_DATA 0xe0005000
  89. #define JAZZ_KEYBOARD_COMMAND 0xe0005001
  90. #ifndef __ASSEMBLY__
  91. typedef struct {
  92. unsigned char data;
  93. unsigned char command;
  94. } jazz_keyboard_hardware;
  95. #define jazz_kh ((keyboard_hardware *) JAZZ_KEYBOARD_ADDRESS)
  96. typedef struct {
  97. unsigned char pad0[3];
  98. unsigned char data;
  99. unsigned char pad1[3];
  100. unsigned char command;
  101. } mips_keyboard_hardware;
  102. /*
  103. * For now. Needs to be changed for RC3xxx support. See below.
  104. */
  105. #define keyboard_hardware jazz_keyboard_hardware
  106. #endif /* !__ASSEMBLY__ */
  107. /*
  108. * i8042 keyboard controller for most other Mips machines.
  109. */
  110. #define MIPS_KEYBOARD_ADDRESS 0xb9005000
  111. #define MIPS_KEYBOARD_DATA 0xb9005003
  112. #define MIPS_KEYBOARD_COMMAND 0xb9005007
  113. /*
  114. * Serial and parallel ports (WD 16C552) on the Mips JAZZ
  115. */
  116. #define JAZZ_SERIAL1_BASE (unsigned int)0xe0006000
  117. #define JAZZ_SERIAL2_BASE (unsigned int)0xe0007000
  118. #define JAZZ_PARALLEL_BASE (unsigned int)0xe0008000
  119. /*
  120. * Dummy Device Address. Used in jazzdma.c
  121. */
  122. #define JAZZ_DUMMY_DEVICE 0xe000d000
  123. /*
  124. * JAZZ timer registers and interrupt no.
  125. * Note that the hardware timer interrupt is actually on
  126. * cpu level 6, but to keep compatibility with PC stuff
  127. * it is remapped to vector 0. See arch/mips/kernel/entry.S.
  128. */
  129. #define JAZZ_TIMER_INTERVAL 0xe0000228
  130. #define JAZZ_TIMER_REGISTER 0xe0000230
  131. /*
  132. * DRAM configuration register
  133. */
  134. #ifndef __ASSEMBLY__
  135. #ifdef __MIPSEL__
  136. typedef struct {
  137. unsigned int bank2 : 3;
  138. unsigned int bank1 : 3;
  139. unsigned int mem_bus_width : 1;
  140. unsigned int reserved2 : 1;
  141. unsigned int page_mode : 1;
  142. unsigned int reserved1 : 23;
  143. } dram_configuration;
  144. #else /* defined (__MIPSEB__) */
  145. typedef struct {
  146. unsigned int reserved1 : 23;
  147. unsigned int page_mode : 1;
  148. unsigned int reserved2 : 1;
  149. unsigned int mem_bus_width : 1;
  150. unsigned int bank1 : 3;
  151. unsigned int bank2 : 3;
  152. } dram_configuration;
  153. #endif
  154. #endif /* !__ASSEMBLY__ */
  155. #define PICA_DRAM_CONFIG 0xe00fffe0
  156. /*
  157. * JAZZ interrupt control registers
  158. */
  159. #define JAZZ_IO_IRQ_SOURCE 0xe0010000
  160. #define JAZZ_IO_IRQ_ENABLE 0xe0010002
  161. /*
  162. * JAZZ Interrupt Level definitions
  163. *
  164. * This is somewhat broken. For reasons which nobody can remember anymore
  165. * we remap the Jazz interrupts to the usual ISA style interrupt numbers.
  166. */
  167. #define JAZZ_IRQ_START 24
  168. #define JAZZ_IRQ_END (24 + 9)
  169. #define JAZZ_PARALLEL_IRQ (JAZZ_IRQ_START + 0)
  170. #define JAZZ_FLOPPY_IRQ (JAZZ_IRQ_START + 1)
  171. #define JAZZ_SOUND_IRQ (JAZZ_IRQ_START + 2)
  172. #define JAZZ_VIDEO_IRQ (JAZZ_IRQ_START + 3)
  173. #define JAZZ_ETHERNET_IRQ (JAZZ_IRQ_START + 4)
  174. #define JAZZ_SCSI_IRQ (JAZZ_IRQ_START + 5)
  175. #define JAZZ_KEYBOARD_IRQ (JAZZ_IRQ_START + 6)
  176. #define JAZZ_MOUSE_IRQ (JAZZ_IRQ_START + 7)
  177. #define JAZZ_SERIAL1_IRQ (JAZZ_IRQ_START + 8)
  178. #define JAZZ_SERIAL2_IRQ (JAZZ_IRQ_START + 9)
  179. #define JAZZ_TIMER_IRQ (MIPS_CPU_IRQ_BASE+6)
  180. /*
  181. * JAZZ DMA Channels
  182. * Note: Channels 4...7 are not used with respect to the Acer PICA-61
  183. * chipset which does not provide these DMA channels.
  184. */
  185. #define JAZZ_SCSI_DMA 0 /* SCSI */
  186. #define JAZZ_FLOPPY_DMA 1 /* FLOPPY */
  187. #define JAZZ_AUDIOL_DMA 2 /* AUDIO L */
  188. #define JAZZ_AUDIOR_DMA 3 /* AUDIO R */
  189. /*
  190. * JAZZ R4030 MCT_ADR chip (DMA controller)
  191. * Note: Virtual Addresses !
  192. */
  193. #define JAZZ_R4030_CONFIG 0xE0000000 /* R4030 config register */
  194. #define JAZZ_R4030_REVISION 0xE0000008 /* same as PICA_ASIC_REVISION */
  195. #define JAZZ_R4030_INV_ADDR 0xE0000010 /* Invalid Address register */
  196. #define JAZZ_R4030_TRSTBL_BASE 0xE0000018 /* Translation Table Base */
  197. #define JAZZ_R4030_TRSTBL_LIM 0xE0000020 /* Translation Table Limit */
  198. #define JAZZ_R4030_TRSTBL_INV 0xE0000028 /* Translation Table Invalidate */
  199. #define JAZZ_R4030_CACHE_MTNC 0xE0000030 /* Cache Maintenance */
  200. #define JAZZ_R4030_R_FAIL_ADDR 0xE0000038 /* Remote Failed Address */
  201. #define JAZZ_R4030_M_FAIL_ADDR 0xE0000040 /* Memory Failed Address */
  202. #define JAZZ_R4030_CACHE_PTAG 0xE0000048 /* I/O Cache Physical Tag */
  203. #define JAZZ_R4030_CACHE_LTAG 0xE0000050 /* I/O Cache Logical Tag */
  204. #define JAZZ_R4030_CACHE_BMASK 0xE0000058 /* I/O Cache Byte Mask */
  205. #define JAZZ_R4030_CACHE_BWIN 0xE0000060 /* I/O Cache Buffer Window */
  206. /*
  207. * Remote Speed Registers.
  208. *
  209. * 0: free, 1: Ethernet, 2: SCSI, 3: Floppy,
  210. * 4: RTC, 5: Kb./Mouse 6: serial 1, 7: serial 2,
  211. * 8: parallel, 9: NVRAM, 10: CPU, 11: PROM,
  212. * 12: reserved, 13: free, 14: 7seg LED, 15: ???
  213. */
  214. #define JAZZ_R4030_REM_SPEED 0xE0000070 /* 16 Remote Speed Registers */
  215. /* 0xE0000070,78,80... 0xE00000E8 */
  216. #define JAZZ_R4030_IRQ_ENABLE 0xE00000E8 /* Internal Interrupt Enable */
  217. #define JAZZ_R4030_INVAL_ADDR 0xE0000010 /* Invalid address Register */
  218. #define JAZZ_R4030_IRQ_SOURCE 0xE0000200 /* Interrupt Source Register */
  219. #define JAZZ_R4030_I386_ERROR 0xE0000208 /* i386/EISA Bus Error */
  220. /*
  221. * Virtual (E)ISA controller address
  222. */
  223. #define JAZZ_EISA_IRQ_ACK 0xE0000238 /* EISA interrupt acknowledge */
  224. /*
  225. * Access the R4030 DMA and I/O Controller
  226. */
  227. #ifndef __ASSEMBLY__
  228. static inline void r4030_delay(void)
  229. {
  230. __asm__ __volatile__(
  231. ".set\tnoreorder\n\t"
  232. "nop\n\t"
  233. "nop\n\t"
  234. "nop\n\t"
  235. "nop\n\t"
  236. ".set\treorder");
  237. }
  238. static inline unsigned short r4030_read_reg16(unsigned long addr)
  239. {
  240. unsigned short ret = *((volatile unsigned short *)addr);
  241. r4030_delay();
  242. return ret;
  243. }
  244. static inline unsigned int r4030_read_reg32(unsigned long addr)
  245. {
  246. unsigned int ret = *((volatile unsigned int *)addr);
  247. r4030_delay();
  248. return ret;
  249. }
  250. static inline void r4030_write_reg16(unsigned long addr, unsigned val)
  251. {
  252. *((volatile unsigned short *)addr) = val;
  253. r4030_delay();
  254. }
  255. static inline void r4030_write_reg32(unsigned long addr, unsigned val)
  256. {
  257. *((volatile unsigned int *)addr) = val;
  258. r4030_delay();
  259. }
  260. #endif /* !__ASSEMBLY__ */
  261. #define JAZZ_FDC_BASE 0xe0003000
  262. #define JAZZ_RTC_BASE 0xe0004000
  263. #define JAZZ_PORT_BASE 0xe2000000
  264. #define JAZZ_EISA_BASE 0xe3000000
  265. #endif /* __ASM_JAZZ_H */