1 /*
2  * vac.h: Various VIC controller defines.  The VIC is a VME controller
3  *        used in Baget/MIPS series.
4  *
5  * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov
6  */
7 #ifndef _ASM_VAC_H
8 #define _ASM_VAC_H
9 
10 #define VAC_SLSEL1_MASK      0x000
11 #define VAC_SLSEL1_BASE      0x100
12 #define VAC_SLSEL0_MASK      0x200
13 #define VAC_SLSEL0_BASE      0x300
14 #define VAC_ICFSEL_BASE      0x400
15 #define VAC_ICFSEL_GLOBAL_VAL(x) (((x)>>8)&0xff)
16 #define VAC_ICFSEL_MODULE_VAL(x) ((x)&0xff)
17 #define VAC_DRAM_MASK        0x500
18 #define VAC_BNDR2            0x600
19 #define VAC_BNDR3            0x700
20 #define VAC_A24_BASE         0x800
21 #define    VAC_A24_MASK          (0x3f<<9)
22 #define    VAC_A24_D32_ENABLE    (1<<8)
23 #define    VAC_A24_A24_CACHINH   (1<<7)
24 #define    VAC_A24_A16D32_ENABLE (1<<6)
25 #define    VAC_A24_A16D32        (1<<5)
26 #define    VAC_A24_DATAPATH      (1<<4)
27 #define    VAC_A24_IO_CACHINH    (1<<3)
28 #define VAC_REG1             0x900
29 #define VAC_REG2             0xA00
30 #define VAC_REG3             0xB00
31 #define    VAC_REG_WORD      (1<<15)
32 #define    VAC_REG_ASIZ1     (1<<14)
33 #define    VAC_REG_ASIZ0     (1<<13)
34 #define    VAC_REG_ASIZ_VAL(x) (((x)>>13)&3)
35 #define    VAC_REG_CACHINH   (1<<12)
36 #define    VAC_REG_INACTIVE  (0<<10)
37 #define    VAC_REG_SHARED    (1<<10)
38 #define    VAC_REG_VSB       (2<<10)
39 #define    VAC_REG_MWB       (3<<10)
40 #define    VAC_REG_MASK      (3<<10)
41 #define    VAC_REG_MODE(x)   (((x)>>10)&3)
42 #define VAC_IOSEL4_CTRL      0xC00
43 #define VAC_IOSEL5_CTRL      0xD00
44 #define VAC_SHRCS_CTRL       0xE00
45 #define VAC_EPROMCS_CTRL     0xF00
46 #define VAC_IOSEL0_CTRL      0x1000
47 #define VAC_IOSEL1_CTRL      0x1100
48 #define VAC_IOSEL2_CTRL      0x1200
49 #define VAC_IOSEL3_CTRL      0x1300
50 #define    VAC_CTRL_IOWR               (1<<0)
51 #define    VAC_CTRL_IORD               (1<<1)
52 #define    VAC_CTRL_DELAY_IOSELI(x)    (((x)&3)<<2)
53 #define    VAC_CTRL_DELAY_IOSELI_VAL(x) (((x)>>2)&3)
54 #define    VAC_CTRL_DELAY_IOWR(x)      (((x)&3)<<4)
55 #define    VAC_CTRL_DELAY_IOWR_VAL(x)  (((x)>>4)&3)
56 #define    VAC_CTRL_DELAY_IORD(x)      (((x)&3)<<6)
57 #define    VAC_CTRL_DELAY_IORD_VAL(x)  (((x)>>6)&3)
58 #define    VAC_CTRL_RECOVERY_IOSELI(x) ((((x)-1)&7)<<8)
59 #define    VAC_CTRL_RECOVERY_IOSELI_VAL(x) ((((x)>>8)&7)+1)
60 #define    VAC_CTRL_DSACK0             (1<<11)
61 #define    VAC_CTRL_DSACK1             (1<<12)
62 #define    VAC_CTRL_DELAY_DSACKI(x)    ((((x)-1)&7)<<13)
63 #define    VAC_CTRL_DELAY_DSACKI_VAL(x) ((((x)>>13)&7)+1)
64 #define VAC_DECODE_CTRL      0x1400
65 #define    VAC_DECODE_FPUCS   (1<<0)
66 #define    VAC_DECODE_CPUCLK(x)  (((x)&3)<<1)
67 #define    VAC_DECODE_CPUCLK_VAL(x) (((x)>>1)&3)
68 #define    VAC_DECODE_RDR_SLSEL0 (1<<3)
69 #define    VAC_DECODE_RDR_SLSEL1 (1<<4)
70 #define    VAC_DECODE_DSACK   (1<<5)
71 #define    VAC_DECODE_QFY_BNDR    (1<<6)
72 #define    VAC_DECODE_QFY_ICFSEL  (1<<7)
73 #define    VAC_DECODE_QFY_SLSEL1  (1<<8)
74 #define    VAC_DECODE_QFY_SLSEL0  (1<<9)
75 #define    VAC_DECODE_CMP_SLSEL1_LO  (1<<10)
76 #define    VAC_DECODE_CMP_SLSEL1_HI  (1<<11)
77 #define    VAC_DECODE_CMP_SLSEL1_VAL(x) (((x)>>10)&3)
78 #define    VAC_DECODE_DRAMCS  (3<<12)
79 #define    VAC_DECODE_SHRCS   (2<<12)
80 #define    VAC_DECODE_VSBSEL  (1<<12)
81 #define    VAC_DECODE_EPROMCS (0<<12)
82 #define    VAC_DECODE_MODE_VAL(x) (((x)>>12)&3)
83 #define    VAC_DECODE_QFY_DRAMCS  (1<<14)
84 #define    VAC_DECODE_DSACKI  (1<<15)
85 #define VAC_INT_STATUS       0x1500
86 #define VAC_INT_CTRL         0x1600
87 #define    VAC_INT_CTRL_TIMER_PIO11    (3<<0)
88 #define    VAC_INT_CTRL_TIMER_PIO10    (2<<0)
89 #define    VAC_INT_CTRL_TIMER_PIO7     (1<<0)
90 #define    VAC_INT_CTRL_TIMER_DISABLE  (0<<0)
91 #define    VAC_INT_CTRL_TIMER_MASK     (3<<0)
92 #define    VAC_INT_CTRL_UART_B_PIO11   (3<<2)
93 #define    VAC_INT_CTRL_UART_B_PIO10   (2<<2)
94 #define    VAC_INT_CTRL_UART_B_PIO7    (1<<2)
95 #define    VAC_INT_CTRL_UART_B_DISABLE (0<<2)
96 #define    VAC_INT_CTRL_UART_A_PIO11   (3<<4)
97 #define    VAC_INT_CTRL_UART_A_PIO10   (2<<4)
98 #define    VAC_INT_CTRL_UART_A_PIO7    (1<<4)
99 #define    VAC_INT_CTRL_UART_A_DISABLE (0<<4)
100 #define    VAC_INT_CTRL_MBOX_PIO11     (3<<6)
101 #define    VAC_INT_CTRL_MBOX_PIO10     (2<<6)
102 #define    VAC_INT_CTRL_MBOX_PIO7      (1<<6)
103 #define    VAC_INT_CTRL_MBOX_DISABLE   (0<<6)
104 #define    VAC_INT_CTRL_PIO4_PIO11     (3<<8)
105 #define    VAC_INT_CTRL_PIO4_PIO10     (2<<8)
106 #define    VAC_INT_CTRL_PIO4_PIO7      (1<<8)
107 #define    VAC_INT_CTRL_PIO4_DISABLE   (0<<8)
108 #define    VAC_INT_CTRL_PIO7_PIO11     (3<<10)
109 #define    VAC_INT_CTRL_PIO7_PIO10     (2<<10)
110 #define    VAC_INT_CTRL_PIO7_PIO7      (1<<10)
111 #define    VAC_INT_CTRL_PIO7_DISABLE   (0<<10)
112 #define    VAC_INT_CTRL_PIO8_PIO11     (3<<12)
113 #define    VAC_INT_CTRL_PIO8_PIO10     (2<<12)
114 #define    VAC_INT_CTRL_PIO8_PIO7      (1<<12)
115 #define    VAC_INT_CTRL_PIO8_DISABLE   (0<<12)
116 #define    VAC_INT_CTRL_PIO9_PIO11     (3<<14)
117 #define    VAC_INT_CTRL_PIO9_PIO10     (2<<14)
118 #define    VAC_INT_CTRL_PIO9_PIO7      (1<<14)
119 #define    VAC_INT_CTRL_PIO9_DISABLE   (0<<14)
120 #define VAC_DEV_LOC          0x1700
121 #define    VAC_DEV_LOC_IOSEL(x)   (1<<(x))
122 #define VAC_PIO_DATA_OUT     0x1800
123 #define VAC_PIO_PIN          0x1900
124 #define VAC_PIO_DIRECTION    0x1A00
125 #define    VAC_PIO_DIR_OUT(x)     (1<<(x))
126 #define    VAC_PIO_DIR_IN(x)      (0<<(x))
127 #define    VAC_PIO_DIR_FCIACK     (1<<14)
128 #define VAC_PIO_FUNC         0x1B00
129 #define    VAC_PIO_FUNC_UART_A_TX (1<<0)
130 #define    VAC_PIO_FUNC_UART_A_RX (1<<1)
131 #define    VAC_PIO_FUNC_UART_B_TX (1<<2)
132 #define    VAC_PIO_FUNC_UART_B_RX (1<<3)
133 #define    VAC_PIO_FUNC_IORD      (1<<4)
134 #define    VAC_PIO_FUNC_IOWR      (1<<5)
135 #define    VAC_PIO_FUNC_IOSEL3    (1<<6)
136 #define    VAC_PIO_FUNC_IRQ7      (1<<7)
137 #define    VAC_PIO_FUNC_IOSEL4    (1<<8)
138 #define    VAC_PIO_FUNC_IOSEL5    (1<<9)
139 #define    VAC_PIO_FUNC_IRQ10     (1<<10)
140 #define    VAC_PIO_FUNC_IRQ11     (1<<11)
141 #define    VAC_PIO_FUNC_OUT       (1<<12)
142 #define    VAC_PIO_FUNC_IOSEL2    (1<<13)
143 #define    VAC_PIO_FUNC_DELAY     (1<<14)
144 #define    VAC_PIO_FUNC_FCIACK    (1<<15)
145 #define VAC_CPU_CLK_DIV      0x1C00
146 #define VAC_UART_A_MODE      0x1D00
147 #define    VAC_UART_MODE_PARITY_ENABLE  (1<<15) /* Inversed in manual ? */
148 #define    VAC_UART_MODE_PARITY_ODD     (1<<14) /* Inversed in manual ? */
149 #define    VAC_UART_MODE_8BIT_CHAR      (1<<13)
150 #define    VAC_UART_MODE_BAUD(x)        (((x)&7)<<10)
151 #define    VAC_UART_MODE_CHAR_RX_ENABLE (1<<9)
152 #define    VAC_UART_MODE_CHAR_TX_ENABLE (1<<8)
153 #define    VAC_UART_MODE_TX_ENABLE      (1<<7)
154 #define    VAC_UART_MODE_RX_ENABLE      (1<<6)
155 #define    VAC_UART_MODE_SEND_BREAK     (1<<5)
156 #define    VAC_UART_MODE_LOOPBACK       (1<<4)
157 #define    VAC_UART_MODE_INITIAL        (VAC_UART_MODE_8BIT_CHAR | \
158                                          VAC_UART_MODE_TX_ENABLE | \
159                                          VAC_UART_MODE_RX_ENABLE | \
160                                          VAC_UART_MODE_CHAR_TX_ENABLE | \
161                                          VAC_UART_MODE_CHAR_RX_ENABLE | \
162                                          VAC_UART_MODE_BAUD(5)) /* 9600/4 */
163 #define VAC_UART_A_TX        0x1E00
164 #define VAC_UART_B_MODE      0x1F00
165 #define VAC_UART_A_RX        0x2000
166 #define    VAC_UART_RX_ERR_BREAK        (1<<10)
167 #define    VAC_UART_RX_ERR_FRAME        (1<<9)
168 #define    VAC_UART_RX_ERR_PARITY       (1<<8)
169 #define    VAC_UART_RX_DATA_MASK        (0xff)
170 #define VAC_UART_B_RX        0x2100
171 #define VAC_UART_B_TX        0x2200
172 #define VAC_UART_A_INT_MASK  0x2300
173 #define    VAC_UART_INT_RX_READY        (1<<15)
174 #define    VAC_UART_INT_RX_FULL         (1<<14)
175 #define    VAC_UART_INT_RX_BREAK_CHANGE (1<<13)
176 #define    VAC_UART_INT_RX_ERRS         (1<<12)
177 #define    VAC_UART_INT_TX_READY        (1<<11)
178 #define    VAC_UART_INT_TX_EMPTY        (1<<10)
179 #define VAC_UART_B_INT_MASK  0x2400
180 #define VAC_UART_A_INT_STATUS  0x2500
181 #define    VAC_UART_STATUS_RX_READY        (1<<15)
182 #define    VAC_UART_STATUS_RX_FULL         (1<<14)
183 #define    VAC_UART_STATUS_RX_BREAK_CHANGE (1<<13)
184 #define    VAC_UART_STATUS_RX_ERR_PARITY   (1<<12)
185 #define    VAC_UART_STATUS_RX_ERR_FRAME    (1<<11)
186 #define    VAC_UART_STATUS_RX_ERR_OVERRUN  (1<<10)
187 #define    VAC_UART_STATUS_TX_READY        (1<<9)
188 #define    VAC_UART_STATUS_TX_EMPTY        (1<<8)
189 #define    VAC_UART_STATUS_INTS            (0xff<<8)
190 #define VAC_UART_B_INT_STATUS  0x2600
191 #define VAC_TIMER_DATA       0x2700
192 #define VAC_TIMER_CTRL       0x2800
193 #define    VAC_TIMER_ONCE      (1<<15)
194 #define    VAC_TIMER_ENABLE    (1<<14)
195 #define    VAC_TIMER_PRESCALE(x) (((x)&0x3F)<<8)
196 #define VAC_ID               0x2900
197 
198 
199 #ifndef __ASSEMBLY__
200 
201 #define vac_inb(p)    (*(volatile unsigned char *)(VAC_BASE + (p)))
202 #define vac_outb(v,p) (*((volatile unsigned char *)(VAC_BASE + (p))) = v)
203 #define vac_inw(p)    (*(volatile unsigned short*)(VAC_BASE + (p)))
204 #define vac_outw(v,p) (*((volatile unsigned short*)(VAC_BASE + (p))) = v)
205 
206 #endif /* !__ASSEMBLY__ */
207 
208 #endif /* _ASM_VAC_H */
209