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