diff options
Diffstat (limited to 'include/asm-mips/mach-au1x00')
-rw-r--r-- | include/asm-mips/mach-au1x00/au1000.h | 1408 | ||||
-rw-r--r-- | include/asm-mips/mach-au1x00/au1000_dma.h | 446 | ||||
-rw-r--r-- | include/asm-mips/mach-au1x00/au1000_gpio.h | 56 | ||||
-rw-r--r-- | include/asm-mips/mach-au1x00/au1000_usbdev.h | 73 | ||||
-rw-r--r-- | include/asm-mips/mach-au1x00/au1100_mmc.h | 205 | ||||
-rw-r--r-- | include/asm-mips/mach-au1x00/au1xxx_dbdma.h | 299 | ||||
-rw-r--r-- | include/asm-mips/mach-au1x00/au1xxx_psc.h | 522 | ||||
-rw-r--r-- | include/asm-mips/mach-au1x00/timex.h | 13 |
8 files changed, 3022 insertions, 0 deletions
diff --git a/include/asm-mips/mach-au1x00/au1000.h b/include/asm-mips/mach-au1x00/au1000.h new file mode 100644 index 000000000000..2b36ea346910 --- /dev/null +++ b/include/asm-mips/mach-au1x00/au1000.h | |||
@@ -0,0 +1,1408 @@ | |||
1 | /* | ||
2 | * | ||
3 | * BRIEF MODULE DESCRIPTION | ||
4 | * Include file for Alchemy Semiconductor's Au1k CPU. | ||
5 | * | ||
6 | * Copyright 2000,2001 MontaVista Software Inc. | ||
7 | * Author: MontaVista Software, Inc. | ||
8 | * ppopov@mvista.com or source@mvista.com | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License as published by the | ||
12 | * Free Software Foundation; either version 2 of the License, or (at your | ||
13 | * option) any later version. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
16 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
17 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
18 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
21 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
22 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | * You should have received a copy of the GNU General Public License along | ||
27 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
28 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
29 | */ | ||
30 | |||
31 | /* | ||
32 | * some definitions add by takuzo@sm.sony.co.jp and sato@sm.sony.co.jp | ||
33 | */ | ||
34 | |||
35 | #ifndef _AU1000_H_ | ||
36 | #define _AU1000_H_ | ||
37 | |||
38 | #include <linux/config.h> | ||
39 | |||
40 | #ifndef _LANGUAGE_ASSEMBLY | ||
41 | |||
42 | #include <linux/delay.h> | ||
43 | #include <asm/io.h> | ||
44 | |||
45 | /* cpu pipeline flush */ | ||
46 | void static inline au_sync(void) | ||
47 | { | ||
48 | __asm__ volatile ("sync"); | ||
49 | } | ||
50 | |||
51 | void static inline au_sync_udelay(int us) | ||
52 | { | ||
53 | __asm__ volatile ("sync"); | ||
54 | udelay(us); | ||
55 | } | ||
56 | |||
57 | void static inline au_sync_delay(int ms) | ||
58 | { | ||
59 | __asm__ volatile ("sync"); | ||
60 | mdelay(ms); | ||
61 | } | ||
62 | |||
63 | void static inline au_writeb(u8 val, int reg) | ||
64 | { | ||
65 | *(volatile u8 *)(reg) = val; | ||
66 | } | ||
67 | |||
68 | void static inline au_writew(u16 val, int reg) | ||
69 | { | ||
70 | *(volatile u16 *)(reg) = val; | ||
71 | } | ||
72 | |||
73 | void static inline au_writel(u32 val, int reg) | ||
74 | { | ||
75 | *(volatile u32 *)(reg) = val; | ||
76 | } | ||
77 | |||
78 | static inline u8 au_readb(unsigned long port) | ||
79 | { | ||
80 | return (*(volatile u8 *)port); | ||
81 | } | ||
82 | |||
83 | static inline u16 au_readw(unsigned long port) | ||
84 | { | ||
85 | return (*(volatile u16 *)port); | ||
86 | } | ||
87 | |||
88 | static inline u32 au_readl(unsigned long port) | ||
89 | { | ||
90 | return (*(volatile u32 *)port); | ||
91 | } | ||
92 | |||
93 | /* These next three functions should be a generic part of the MIPS | ||
94 | * kernel (with the 'au_' removed from the name) and selected for | ||
95 | * processors that support the instructions. | ||
96 | * Taken from PPC tree. -- Dan | ||
97 | */ | ||
98 | /* Return the bit position of the most significant 1 bit in a word */ | ||
99 | static __inline__ int __ilog2(unsigned int x) | ||
100 | { | ||
101 | int lz; | ||
102 | |||
103 | asm volatile ( | ||
104 | ".set\tnoreorder\n\t" | ||
105 | ".set\tnoat\n\t" | ||
106 | ".set\tmips32\n\t" | ||
107 | "clz\t%0,%1\n\t" | ||
108 | ".set\tmips0\n\t" | ||
109 | ".set\tat\n\t" | ||
110 | ".set\treorder" | ||
111 | : "=r" (lz) | ||
112 | : "r" (x)); | ||
113 | |||
114 | return 31 - lz; | ||
115 | } | ||
116 | |||
117 | static __inline__ int au_ffz(unsigned int x) | ||
118 | { | ||
119 | if ((x = ~x) == 0) | ||
120 | return 32; | ||
121 | return __ilog2(x & -x); | ||
122 | } | ||
123 | |||
124 | /* | ||
125 | * ffs: find first bit set. This is defined the same way as | ||
126 | * the libc and compiler builtin ffs routines, therefore | ||
127 | * differs in spirit from the above ffz (man ffs). | ||
128 | */ | ||
129 | static __inline__ int au_ffs(int x) | ||
130 | { | ||
131 | return __ilog2(x & -x) + 1; | ||
132 | } | ||
133 | |||
134 | /* arch/mips/au1000/common/clocks.c */ | ||
135 | extern void set_au1x00_speed(unsigned int new_freq); | ||
136 | extern unsigned int get_au1x00_speed(void); | ||
137 | extern void set_au1x00_uart_baud_base(unsigned long new_baud_base); | ||
138 | extern unsigned long get_au1x00_uart_baud_base(void); | ||
139 | extern void set_au1x00_lcd_clock(void); | ||
140 | extern unsigned int get_au1x00_lcd_clock(void); | ||
141 | |||
142 | /* | ||
143 | * Every board describes its IRQ mapping with this table. | ||
144 | */ | ||
145 | typedef struct au1xxx_irqmap { | ||
146 | int im_irq; | ||
147 | int im_type; | ||
148 | int im_request; | ||
149 | } au1xxx_irq_map_t; | ||
150 | |||
151 | /* | ||
152 | * init_IRQ looks for a table with this name. | ||
153 | */ | ||
154 | extern au1xxx_irq_map_t au1xxx_irq_map[]; | ||
155 | |||
156 | #endif /* !defined (_LANGUAGE_ASSEMBLY) */ | ||
157 | |||
158 | #ifdef CONFIG_PM | ||
159 | /* no CP0 timer irq */ | ||
160 | #define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4) | ||
161 | #else | ||
162 | #define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5) | ||
163 | #endif | ||
164 | |||
165 | /* SDRAM Controller */ | ||
166 | #if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1100) | ||
167 | #define MEM_SDMODE0 0xB4000000 | ||
168 | #define MEM_SDMODE1 0xB4000004 | ||
169 | #define MEM_SDMODE2 0xB4000008 | ||
170 | |||
171 | #define MEM_SDADDR0 0xB400000C | ||
172 | #define MEM_SDADDR1 0xB4000010 | ||
173 | #define MEM_SDADDR2 0xB4000014 | ||
174 | |||
175 | #define MEM_SDREFCFG 0xB4000018 | ||
176 | #define MEM_SDPRECMD 0xB400001C | ||
177 | #define MEM_SDAUTOREF 0xB4000020 | ||
178 | |||
179 | #define MEM_SDWRMD0 0xB4000024 | ||
180 | #define MEM_SDWRMD1 0xB4000028 | ||
181 | #define MEM_SDWRMD2 0xB400002C | ||
182 | |||
183 | #define MEM_SDSLEEP 0xB4000030 | ||
184 | #define MEM_SDSMCKE 0xB4000034 | ||
185 | #endif | ||
186 | |||
187 | /* Static Bus Controller */ | ||
188 | #define MEM_STCFG0 0xB4001000 | ||
189 | #define MEM_STTIME0 0xB4001004 | ||
190 | #define MEM_STADDR0 0xB4001008 | ||
191 | |||
192 | #define MEM_STCFG1 0xB4001010 | ||
193 | #define MEM_STTIME1 0xB4001014 | ||
194 | #define MEM_STADDR1 0xB4001018 | ||
195 | |||
196 | #define MEM_STCFG2 0xB4001020 | ||
197 | #define MEM_STTIME2 0xB4001024 | ||
198 | #define MEM_STADDR2 0xB4001028 | ||
199 | |||
200 | #define MEM_STCFG3 0xB4001030 | ||
201 | #define MEM_STTIME3 0xB4001034 | ||
202 | #define MEM_STADDR3 0xB4001038 | ||
203 | |||
204 | #if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200) | ||
205 | #define MEM_STNDCTL 0xB4001100 | ||
206 | #define MEM_STSTAT 0xB4001104 | ||
207 | |||
208 | #define MEM_STNAND_CMD (0x0) | ||
209 | #define MEM_STNAND_ADDR (0x4) | ||
210 | #define MEM_STNAND_DATA (0x20) | ||
211 | #endif | ||
212 | |||
213 | /* Interrupt Controller 0 */ | ||
214 | #define IC0_CFG0RD 0xB0400040 | ||
215 | #define IC0_CFG0SET 0xB0400040 | ||
216 | #define IC0_CFG0CLR 0xB0400044 | ||
217 | |||
218 | #define IC0_CFG1RD 0xB0400048 | ||
219 | #define IC0_CFG1SET 0xB0400048 | ||
220 | #define IC0_CFG1CLR 0xB040004C | ||
221 | |||
222 | #define IC0_CFG2RD 0xB0400050 | ||
223 | #define IC0_CFG2SET 0xB0400050 | ||
224 | #define IC0_CFG2CLR 0xB0400054 | ||
225 | |||
226 | #define IC0_REQ0INT 0xB0400054 | ||
227 | #define IC0_SRCRD 0xB0400058 | ||
228 | #define IC0_SRCSET 0xB0400058 | ||
229 | #define IC0_SRCCLR 0xB040005C | ||
230 | #define IC0_REQ1INT 0xB040005C | ||
231 | |||
232 | #define IC0_ASSIGNRD 0xB0400060 | ||
233 | #define IC0_ASSIGNSET 0xB0400060 | ||
234 | #define IC0_ASSIGNCLR 0xB0400064 | ||
235 | |||
236 | #define IC0_WAKERD 0xB0400068 | ||
237 | #define IC0_WAKESET 0xB0400068 | ||
238 | #define IC0_WAKECLR 0xB040006C | ||
239 | |||
240 | #define IC0_MASKRD 0xB0400070 | ||
241 | #define IC0_MASKSET 0xB0400070 | ||
242 | #define IC0_MASKCLR 0xB0400074 | ||
243 | |||
244 | #define IC0_RISINGRD 0xB0400078 | ||
245 | #define IC0_RISINGCLR 0xB0400078 | ||
246 | #define IC0_FALLINGRD 0xB040007C | ||
247 | #define IC0_FALLINGCLR 0xB040007C | ||
248 | |||
249 | #define IC0_TESTBIT 0xB0400080 | ||
250 | |||
251 | /* Interrupt Controller 1 */ | ||
252 | #define IC1_CFG0RD 0xB1800040 | ||
253 | #define IC1_CFG0SET 0xB1800040 | ||
254 | #define IC1_CFG0CLR 0xB1800044 | ||
255 | |||
256 | #define IC1_CFG1RD 0xB1800048 | ||
257 | #define IC1_CFG1SET 0xB1800048 | ||
258 | #define IC1_CFG1CLR 0xB180004C | ||
259 | |||
260 | #define IC1_CFG2RD 0xB1800050 | ||
261 | #define IC1_CFG2SET 0xB1800050 | ||
262 | #define IC1_CFG2CLR 0xB1800054 | ||
263 | |||
264 | #define IC1_REQ0INT 0xB1800054 | ||
265 | #define IC1_SRCRD 0xB1800058 | ||
266 | #define IC1_SRCSET 0xB1800058 | ||
267 | #define IC1_SRCCLR 0xB180005C | ||
268 | #define IC1_REQ1INT 0xB180005C | ||
269 | |||
270 | #define IC1_ASSIGNRD 0xB1800060 | ||
271 | #define IC1_ASSIGNSET 0xB1800060 | ||
272 | #define IC1_ASSIGNCLR 0xB1800064 | ||
273 | |||
274 | #define IC1_WAKERD 0xB1800068 | ||
275 | #define IC1_WAKESET 0xB1800068 | ||
276 | #define IC1_WAKECLR 0xB180006C | ||
277 | |||
278 | #define IC1_MASKRD 0xB1800070 | ||
279 | #define IC1_MASKSET 0xB1800070 | ||
280 | #define IC1_MASKCLR 0xB1800074 | ||
281 | |||
282 | #define IC1_RISINGRD 0xB1800078 | ||
283 | #define IC1_RISINGCLR 0xB1800078 | ||
284 | #define IC1_FALLINGRD 0xB180007C | ||
285 | #define IC1_FALLINGCLR 0xB180007C | ||
286 | |||
287 | #define IC1_TESTBIT 0xB1800080 | ||
288 | |||
289 | /* Interrupt Configuration Modes */ | ||
290 | #define INTC_INT_DISABLED 0 | ||
291 | #define INTC_INT_RISE_EDGE 0x1 | ||
292 | #define INTC_INT_FALL_EDGE 0x2 | ||
293 | #define INTC_INT_RISE_AND_FALL_EDGE 0x3 | ||
294 | #define INTC_INT_HIGH_LEVEL 0x5 | ||
295 | #define INTC_INT_LOW_LEVEL 0x6 | ||
296 | #define INTC_INT_HIGH_AND_LOW_LEVEL 0x7 | ||
297 | |||
298 | /* Interrupt Numbers */ | ||
299 | /* Au1000 */ | ||
300 | #ifdef CONFIG_SOC_AU1000 | ||
301 | #define AU1000_UART0_INT 0 | ||
302 | #define AU1000_UART1_INT 1 /* au1000 */ | ||
303 | #define AU1000_UART2_INT 2 /* au1000 */ | ||
304 | #define AU1000_UART3_INT 3 | ||
305 | #define AU1000_SSI0_INT 4 /* au1000 */ | ||
306 | #define AU1000_SSI1_INT 5 /* au1000 */ | ||
307 | #define AU1000_DMA_INT_BASE 6 | ||
308 | #define AU1000_TOY_INT 14 | ||
309 | #define AU1000_TOY_MATCH0_INT 15 | ||
310 | #define AU1000_TOY_MATCH1_INT 16 | ||
311 | #define AU1000_TOY_MATCH2_INT 17 | ||
312 | #define AU1000_RTC_INT 18 | ||
313 | #define AU1000_RTC_MATCH0_INT 19 | ||
314 | #define AU1000_RTC_MATCH1_INT 20 | ||
315 | #define AU1000_RTC_MATCH2_INT 21 | ||
316 | #define AU1000_IRDA_TX_INT 22 /* au1000 */ | ||
317 | #define AU1000_IRDA_RX_INT 23 /* au1000 */ | ||
318 | #define AU1000_USB_DEV_REQ_INT 24 | ||
319 | #define AU1000_USB_DEV_SUS_INT 25 | ||
320 | #define AU1000_USB_HOST_INT 26 | ||
321 | #define AU1000_ACSYNC_INT 27 | ||
322 | #define AU1000_MAC0_DMA_INT 28 | ||
323 | #define AU1000_MAC1_DMA_INT 29 | ||
324 | #define AU1000_I2S_UO_INT 30 /* au1000 */ | ||
325 | #define AU1000_AC97C_INT 31 | ||
326 | #define AU1000_GPIO_0 32 | ||
327 | #define AU1000_GPIO_1 33 | ||
328 | #define AU1000_GPIO_2 34 | ||
329 | #define AU1000_GPIO_3 35 | ||
330 | #define AU1000_GPIO_4 36 | ||
331 | #define AU1000_GPIO_5 37 | ||
332 | #define AU1000_GPIO_6 38 | ||
333 | #define AU1000_GPIO_7 39 | ||
334 | #define AU1000_GPIO_8 40 | ||
335 | #define AU1000_GPIO_9 41 | ||
336 | #define AU1000_GPIO_10 42 | ||
337 | #define AU1000_GPIO_11 43 | ||
338 | #define AU1000_GPIO_12 44 | ||
339 | #define AU1000_GPIO_13 45 | ||
340 | #define AU1000_GPIO_14 46 | ||
341 | #define AU1000_GPIO_15 47 | ||
342 | #define AU1000_GPIO_16 48 | ||
343 | #define AU1000_GPIO_17 49 | ||
344 | #define AU1000_GPIO_18 50 | ||
345 | #define AU1000_GPIO_19 51 | ||
346 | #define AU1000_GPIO_20 52 | ||
347 | #define AU1000_GPIO_21 53 | ||
348 | #define AU1000_GPIO_22 54 | ||
349 | #define AU1000_GPIO_23 55 | ||
350 | #define AU1000_GPIO_24 56 | ||
351 | #define AU1000_GPIO_25 57 | ||
352 | #define AU1000_GPIO_26 58 | ||
353 | #define AU1000_GPIO_27 59 | ||
354 | #define AU1000_GPIO_28 60 | ||
355 | #define AU1000_GPIO_29 61 | ||
356 | #define AU1000_GPIO_30 62 | ||
357 | #define AU1000_GPIO_31 63 | ||
358 | |||
359 | #define UART0_ADDR 0xB1100000 | ||
360 | #define UART1_ADDR 0xB1200000 | ||
361 | #define UART2_ADDR 0xB1300000 | ||
362 | #define UART3_ADDR 0xB1400000 | ||
363 | |||
364 | #define USB_OHCI_BASE 0x10100000 // phys addr for ioremap | ||
365 | #define USB_HOST_CONFIG 0xB017fffc | ||
366 | |||
367 | #define AU1000_ETH0_BASE 0xB0500000 | ||
368 | #define AU1000_ETH1_BASE 0xB0510000 | ||
369 | #define AU1000_MAC0_ENABLE 0xB0520000 | ||
370 | #define AU1000_MAC1_ENABLE 0xB0520004 | ||
371 | #define NUM_ETH_INTERFACES 2 | ||
372 | #endif // CONFIG_SOC_AU1000 | ||
373 | |||
374 | /* Au1500 */ | ||
375 | #ifdef CONFIG_SOC_AU1500 | ||
376 | #define AU1500_UART0_INT 0 | ||
377 | #define AU1000_PCI_INTA 1 /* au1500 */ | ||
378 | #define AU1000_PCI_INTB 2 /* au1500 */ | ||
379 | #define AU1500_UART3_INT 3 | ||
380 | #define AU1000_PCI_INTC 4 /* au1500 */ | ||
381 | #define AU1000_PCI_INTD 5 /* au1500 */ | ||
382 | #define AU1000_DMA_INT_BASE 6 | ||
383 | #define AU1000_TOY_INT 14 | ||
384 | #define AU1000_TOY_MATCH0_INT 15 | ||
385 | #define AU1000_TOY_MATCH1_INT 16 | ||
386 | #define AU1000_TOY_MATCH2_INT 17 | ||
387 | #define AU1000_RTC_INT 18 | ||
388 | #define AU1000_RTC_MATCH0_INT 19 | ||
389 | #define AU1000_RTC_MATCH1_INT 20 | ||
390 | #define AU1000_RTC_MATCH2_INT 21 | ||
391 | #define AU1500_PCI_ERR_INT 22 | ||
392 | #define AU1000_USB_DEV_REQ_INT 24 | ||
393 | #define AU1000_USB_DEV_SUS_INT 25 | ||
394 | #define AU1000_USB_HOST_INT 26 | ||
395 | #define AU1000_ACSYNC_INT 27 | ||
396 | #define AU1500_MAC0_DMA_INT 28 | ||
397 | #define AU1500_MAC1_DMA_INT 29 | ||
398 | #define AU1000_AC97C_INT 31 | ||
399 | #define AU1000_GPIO_0 32 | ||
400 | #define AU1000_GPIO_1 33 | ||
401 | #define AU1000_GPIO_2 34 | ||
402 | #define AU1000_GPIO_3 35 | ||
403 | #define AU1000_GPIO_4 36 | ||
404 | #define AU1000_GPIO_5 37 | ||
405 | #define AU1000_GPIO_6 38 | ||
406 | #define AU1000_GPIO_7 39 | ||
407 | #define AU1000_GPIO_8 40 | ||
408 | #define AU1000_GPIO_9 41 | ||
409 | #define AU1000_GPIO_10 42 | ||
410 | #define AU1000_GPIO_11 43 | ||
411 | #define AU1000_GPIO_12 44 | ||
412 | #define AU1000_GPIO_13 45 | ||
413 | #define AU1000_GPIO_14 46 | ||
414 | #define AU1000_GPIO_15 47 | ||
415 | #define AU1500_GPIO_200 48 | ||
416 | #define AU1500_GPIO_201 49 | ||
417 | #define AU1500_GPIO_202 50 | ||
418 | #define AU1500_GPIO_203 51 | ||
419 | #define AU1500_GPIO_20 52 | ||
420 | #define AU1500_GPIO_204 53 | ||
421 | #define AU1500_GPIO_205 54 | ||
422 | #define AU1500_GPIO_23 55 | ||
423 | #define AU1500_GPIO_24 56 | ||
424 | #define AU1500_GPIO_25 57 | ||
425 | #define AU1500_GPIO_26 58 | ||
426 | #define AU1500_GPIO_27 59 | ||
427 | #define AU1500_GPIO_28 60 | ||
428 | #define AU1500_GPIO_206 61 | ||
429 | #define AU1500_GPIO_207 62 | ||
430 | #define AU1500_GPIO_208_215 63 | ||
431 | |||
432 | #define UART0_ADDR 0xB1100000 | ||
433 | #define UART3_ADDR 0xB1400000 | ||
434 | |||
435 | #define USB_OHCI_BASE 0x10100000 // phys addr for ioremap | ||
436 | #define USB_HOST_CONFIG 0xB017fffc | ||
437 | |||
438 | #define AU1500_ETH0_BASE 0xB1500000 | ||
439 | #define AU1500_ETH1_BASE 0xB1510000 | ||
440 | #define AU1500_MAC0_ENABLE 0xB1520000 | ||
441 | #define AU1500_MAC1_ENABLE 0xB1520004 | ||
442 | #define NUM_ETH_INTERFACES 2 | ||
443 | #endif // CONFIG_SOC_AU1500 | ||
444 | |||
445 | /* Au1100 */ | ||
446 | #ifdef CONFIG_SOC_AU1100 | ||
447 | #define AU1100_UART0_INT 0 | ||
448 | #define AU1100_UART1_INT 1 | ||
449 | #define AU1100_SD_INT 2 | ||
450 | #define AU1100_UART3_INT 3 | ||
451 | #define AU1000_SSI0_INT 4 | ||
452 | #define AU1000_SSI1_INT 5 | ||
453 | #define AU1000_DMA_INT_BASE 6 | ||
454 | #define AU1000_TOY_INT 14 | ||
455 | #define AU1000_TOY_MATCH0_INT 15 | ||
456 | #define AU1000_TOY_MATCH1_INT 16 | ||
457 | #define AU1000_TOY_MATCH2_INT 17 | ||
458 | #define AU1000_RTC_INT 18 | ||
459 | #define AU1000_RTC_MATCH0_INT 19 | ||
460 | #define AU1000_RTC_MATCH1_INT 20 | ||
461 | #define AU1000_RTC_MATCH2_INT 21 | ||
462 | #define AU1000_IRDA_TX_INT 22 | ||
463 | #define AU1000_IRDA_RX_INT 23 | ||
464 | #define AU1000_USB_DEV_REQ_INT 24 | ||
465 | #define AU1000_USB_DEV_SUS_INT 25 | ||
466 | #define AU1000_USB_HOST_INT 26 | ||
467 | #define AU1000_ACSYNC_INT 27 | ||
468 | #define AU1100_MAC0_DMA_INT 28 | ||
469 | #define AU1100_GPIO_208_215 29 | ||
470 | #define AU1100_LCD_INT 30 | ||
471 | #define AU1000_AC97C_INT 31 | ||
472 | #define AU1000_GPIO_0 32 | ||
473 | #define AU1000_GPIO_1 33 | ||
474 | #define AU1000_GPIO_2 34 | ||
475 | #define AU1000_GPIO_3 35 | ||
476 | #define AU1000_GPIO_4 36 | ||
477 | #define AU1000_GPIO_5 37 | ||
478 | #define AU1000_GPIO_6 38 | ||
479 | #define AU1000_GPIO_7 39 | ||
480 | #define AU1000_GPIO_8 40 | ||
481 | #define AU1000_GPIO_9 41 | ||
482 | #define AU1000_GPIO_10 42 | ||
483 | #define AU1000_GPIO_11 43 | ||
484 | #define AU1000_GPIO_12 44 | ||
485 | #define AU1000_GPIO_13 45 | ||
486 | #define AU1000_GPIO_14 46 | ||
487 | #define AU1000_GPIO_15 47 | ||
488 | |||
489 | #define UART0_ADDR 0xB1100000 | ||
490 | #define UART1_ADDR 0xB1200000 | ||
491 | #define UART3_ADDR 0xB1400000 | ||
492 | |||
493 | #define USB_OHCI_BASE 0x10100000 // phys addr for ioremap | ||
494 | #define USB_HOST_CONFIG 0xB017fffc | ||
495 | |||
496 | #define AU1100_ETH0_BASE 0xB0500000 | ||
497 | #define AU1100_MAC0_ENABLE 0xB0520000 | ||
498 | #define NUM_ETH_INTERFACES 1 | ||
499 | #endif // CONFIG_SOC_AU1100 | ||
500 | |||
501 | #ifdef CONFIG_SOC_AU1550 | ||
502 | #define AU1550_UART0_INT 0 | ||
503 | #define AU1550_PCI_INTA 1 | ||
504 | #define AU1550_PCI_INTB 2 | ||
505 | #define AU1550_DDMA_INT 3 | ||
506 | #define AU1550_CRYPTO_INT 4 | ||
507 | #define AU1550_PCI_INTC 5 | ||
508 | #define AU1550_PCI_INTD 6 | ||
509 | #define AU1550_PCI_RST_INT 7 | ||
510 | #define AU1550_UART1_INT 8 | ||
511 | #define AU1550_UART3_INT 9 | ||
512 | #define AU1550_PSC0_INT 10 | ||
513 | #define AU1550_PSC1_INT 11 | ||
514 | #define AU1550_PSC2_INT 12 | ||
515 | #define AU1550_PSC3_INT 13 | ||
516 | #define AU1550_TOY_INT 14 | ||
517 | #define AU1550_TOY_MATCH0_INT 15 | ||
518 | #define AU1550_TOY_MATCH1_INT 16 | ||
519 | #define AU1550_TOY_MATCH2_INT 17 | ||
520 | #define AU1550_RTC_INT 18 | ||
521 | #define AU1550_RTC_MATCH0_INT 19 | ||
522 | #define AU1550_RTC_MATCH1_INT 20 | ||
523 | #define AU1550_RTC_MATCH2_INT 21 | ||
524 | #define AU1550_NAND_INT 23 | ||
525 | #define AU1550_USB_DEV_REQ_INT 24 | ||
526 | #define AU1550_USB_DEV_SUS_INT 25 | ||
527 | #define AU1550_USB_HOST_INT 26 | ||
528 | #define AU1000_USB_DEV_REQ_INT AU1550_USB_DEV_REQ_INT | ||
529 | #define AU1000_USB_DEV_SUS_INT AU1550_USB_DEV_SUS_INT | ||
530 | #define AU1000_USB_HOST_INT AU1550_USB_HOST_INT | ||
531 | #define AU1550_MAC0_DMA_INT 27 | ||
532 | #define AU1550_MAC1_DMA_INT 28 | ||
533 | #define AU1000_GPIO_0 32 | ||
534 | #define AU1000_GPIO_1 33 | ||
535 | #define AU1000_GPIO_2 34 | ||
536 | #define AU1000_GPIO_3 35 | ||
537 | #define AU1000_GPIO_4 36 | ||
538 | #define AU1000_GPIO_5 37 | ||
539 | #define AU1000_GPIO_6 38 | ||
540 | #define AU1000_GPIO_7 39 | ||
541 | #define AU1000_GPIO_8 40 | ||
542 | #define AU1000_GPIO_9 41 | ||
543 | #define AU1000_GPIO_10 42 | ||
544 | #define AU1000_GPIO_11 43 | ||
545 | #define AU1000_GPIO_12 44 | ||
546 | #define AU1000_GPIO_13 45 | ||
547 | #define AU1000_GPIO_14 46 | ||
548 | #define AU1000_GPIO_15 47 | ||
549 | #define AU1550_GPIO_200 48 | ||
550 | #define AU1500_GPIO_201_205 49 // Logical or of GPIO201:205 | ||
551 | #define AU1500_GPIO_16 50 | ||
552 | #define AU1500_GPIO_17 51 | ||
553 | #define AU1500_GPIO_20 52 | ||
554 | #define AU1500_GPIO_21 53 | ||
555 | #define AU1500_GPIO_22 54 | ||
556 | #define AU1500_GPIO_23 55 | ||
557 | #define AU1500_GPIO_24 56 | ||
558 | #define AU1500_GPIO_25 57 | ||
559 | #define AU1500_GPIO_26 58 | ||
560 | #define AU1500_GPIO_27 59 | ||
561 | #define AU1500_GPIO_28 60 | ||
562 | #define AU1500_GPIO_206 61 | ||
563 | #define AU1500_GPIO_207 62 | ||
564 | #define AU1500_GPIO_208_218 63 // Logical or of GPIO208:218 | ||
565 | |||
566 | #define UART0_ADDR 0xB1100000 | ||
567 | #define UART1_ADDR 0xB1200000 | ||
568 | #define UART3_ADDR 0xB1400000 | ||
569 | |||
570 | #define USB_OHCI_BASE 0x14020000 // phys addr for ioremap | ||
571 | #define USB_HOST_CONFIG 0xB4027ffc | ||
572 | |||
573 | #define AU1550_ETH0_BASE 0xB0500000 | ||
574 | #define AU1550_ETH1_BASE 0xB0510000 | ||
575 | #define AU1550_MAC0_ENABLE 0xB0520000 | ||
576 | #define AU1550_MAC1_ENABLE 0xB0520004 | ||
577 | #define NUM_ETH_INTERFACES 2 | ||
578 | #endif // CONFIG_SOC_AU1550 | ||
579 | |||
580 | #ifdef CONFIG_SOC_AU1200 | ||
581 | #define AU1200_UART0_INT 0 | ||
582 | #define AU1200_SWT_INT 1 | ||
583 | #define AU1200_SD_INT 2 | ||
584 | #define AU1200_DDMA_INT 3 | ||
585 | #define AU1200_MAE_BE_INT 4 | ||
586 | #define AU1200_GPIO_200 5 | ||
587 | #define AU1200_GPIO_201 6 | ||
588 | #define AU1200_GPIO_202 7 | ||
589 | #define AU1200_UART1_INT 8 | ||
590 | #define AU1200_MAE_FE_INT 9 | ||
591 | #define AU1200_PSC0_INT 10 | ||
592 | #define AU1200_PSC1_INT 11 | ||
593 | #define AU1200_AES_INT 12 | ||
594 | #define AU1200_CAMERA_INT 13 | ||
595 | #define AU1200_TOY_INT 14 | ||
596 | #define AU1200_TOY_MATCH0_INT 15 | ||
597 | #define AU1200_TOY_MATCH1_INT 16 | ||
598 | #define AU1200_TOY_MATCH2_INT 17 | ||
599 | #define AU1200_RTC_INT 18 | ||
600 | #define AU1200_RTC_MATCH0_INT 19 | ||
601 | #define AU1200_RTC_MATCH1_INT 20 | ||
602 | #define AU1200_RTC_MATCH2_INT 21 | ||
603 | #define AU1200_NAND_INT 23 | ||
604 | #define AU1200_GPIO_204 24 | ||
605 | #define AU1200_GPIO_205 25 | ||
606 | #define AU1200_GPIO_206 26 | ||
607 | #define AU1200_GPIO_207 27 | ||
608 | #define AU1200_GPIO_208_215 28 // Logical OR of 208:215 | ||
609 | #define AU1200_USB_INT 29 | ||
610 | #define AU1200_LCD_INT 30 | ||
611 | #define AU1200_MAE_BOTH_INT 31 | ||
612 | #define AU1000_GPIO_0 32 | ||
613 | #define AU1000_GPIO_1 33 | ||
614 | #define AU1000_GPIO_2 34 | ||
615 | #define AU1000_GPIO_3 35 | ||
616 | #define AU1000_GPIO_4 36 | ||
617 | #define AU1000_GPIO_5 37 | ||
618 | #define AU1000_GPIO_6 38 | ||
619 | #define AU1000_GPIO_7 39 | ||
620 | #define AU1000_GPIO_8 40 | ||
621 | #define AU1000_GPIO_9 41 | ||
622 | #define AU1000_GPIO_10 42 | ||
623 | #define AU1000_GPIO_11 43 | ||
624 | #define AU1000_GPIO_12 44 | ||
625 | #define AU1000_GPIO_13 45 | ||
626 | #define AU1000_GPIO_14 46 | ||
627 | #define AU1000_GPIO_15 47 | ||
628 | #define AU1000_GPIO_16 48 | ||
629 | #define AU1000_GPIO_17 49 | ||
630 | #define AU1000_GPIO_18 50 | ||
631 | #define AU1000_GPIO_19 51 | ||
632 | #define AU1000_GPIO_20 52 | ||
633 | #define AU1000_GPIO_21 53 | ||
634 | #define AU1000_GPIO_22 54 | ||
635 | #define AU1000_GPIO_23 55 | ||
636 | #define AU1000_GPIO_24 56 | ||
637 | #define AU1000_GPIO_25 57 | ||
638 | #define AU1000_GPIO_26 58 | ||
639 | #define AU1000_GPIO_27 59 | ||
640 | #define AU1000_GPIO_28 60 | ||
641 | #define AU1000_GPIO_29 61 | ||
642 | #define AU1000_GPIO_30 62 | ||
643 | #define AU1000_GPIO_31 63 | ||
644 | |||
645 | #define UART0_ADDR 0xB1100000 | ||
646 | #define UART1_ADDR 0xB1200000 | ||
647 | |||
648 | #define USB_OHCI_BASE 0x14020000 // phys addr for ioremap | ||
649 | #define USB_HOST_CONFIG 0xB4027ffc | ||
650 | |||
651 | // these are here for prototyping on au1550 (do not exist on au1200) | ||
652 | #define AU1200_ETH0_BASE 0xB0500000 | ||
653 | #define AU1200_ETH1_BASE 0xB0510000 | ||
654 | #define AU1200_MAC0_ENABLE 0xB0520000 | ||
655 | #define AU1200_MAC1_ENABLE 0xB0520004 | ||
656 | #define NUM_ETH_INTERFACES 2 | ||
657 | #endif // CONFIG_SOC_AU1200 | ||
658 | |||
659 | #define AU1000_LAST_INTC0_INT 31 | ||
660 | #define AU1000_MAX_INTR 63 | ||
661 | |||
662 | |||
663 | /* Programmable Counters 0 and 1 */ | ||
664 | #define SYS_BASE 0xB1900000 | ||
665 | #define SYS_COUNTER_CNTRL (SYS_BASE + 0x14) | ||
666 | #define SYS_CNTRL_E1S (1<<23) | ||
667 | #define SYS_CNTRL_T1S (1<<20) | ||
668 | #define SYS_CNTRL_M21 (1<<19) | ||
669 | #define SYS_CNTRL_M11 (1<<18) | ||
670 | #define SYS_CNTRL_M01 (1<<17) | ||
671 | #define SYS_CNTRL_C1S (1<<16) | ||
672 | #define SYS_CNTRL_BP (1<<14) | ||
673 | #define SYS_CNTRL_EN1 (1<<13) | ||
674 | #define SYS_CNTRL_BT1 (1<<12) | ||
675 | #define SYS_CNTRL_EN0 (1<<11) | ||
676 | #define SYS_CNTRL_BT0 (1<<10) | ||
677 | #define SYS_CNTRL_E0 (1<<8) | ||
678 | #define SYS_CNTRL_E0S (1<<7) | ||
679 | #define SYS_CNTRL_32S (1<<5) | ||
680 | #define SYS_CNTRL_T0S (1<<4) | ||
681 | #define SYS_CNTRL_M20 (1<<3) | ||
682 | #define SYS_CNTRL_M10 (1<<2) | ||
683 | #define SYS_CNTRL_M00 (1<<1) | ||
684 | #define SYS_CNTRL_C0S (1<<0) | ||
685 | |||
686 | /* Programmable Counter 0 Registers */ | ||
687 | #define SYS_TOYTRIM (SYS_BASE + 0) | ||
688 | #define SYS_TOYWRITE (SYS_BASE + 4) | ||
689 | #define SYS_TOYMATCH0 (SYS_BASE + 8) | ||
690 | #define SYS_TOYMATCH1 (SYS_BASE + 0xC) | ||
691 | #define SYS_TOYMATCH2 (SYS_BASE + 0x10) | ||
692 | #define SYS_TOYREAD (SYS_BASE + 0x40) | ||
693 | |||
694 | /* Programmable Counter 1 Registers */ | ||
695 | #define SYS_RTCTRIM (SYS_BASE + 0x44) | ||
696 | #define SYS_RTCWRITE (SYS_BASE + 0x48) | ||
697 | #define SYS_RTCMATCH0 (SYS_BASE + 0x4C) | ||
698 | #define SYS_RTCMATCH1 (SYS_BASE + 0x50) | ||
699 | #define SYS_RTCMATCH2 (SYS_BASE + 0x54) | ||
700 | #define SYS_RTCREAD (SYS_BASE + 0x58) | ||
701 | |||
702 | /* I2S Controller */ | ||
703 | #define I2S_DATA 0xB1000000 | ||
704 | #define I2S_DATA_MASK (0xffffff) | ||
705 | #define I2S_CONFIG 0xB1000004 | ||
706 | #define I2S_CONFIG_XU (1<<25) | ||
707 | #define I2S_CONFIG_XO (1<<24) | ||
708 | #define I2S_CONFIG_RU (1<<23) | ||
709 | #define I2S_CONFIG_RO (1<<22) | ||
710 | #define I2S_CONFIG_TR (1<<21) | ||
711 | #define I2S_CONFIG_TE (1<<20) | ||
712 | #define I2S_CONFIG_TF (1<<19) | ||
713 | #define I2S_CONFIG_RR (1<<18) | ||
714 | #define I2S_CONFIG_RE (1<<17) | ||
715 | #define I2S_CONFIG_RF (1<<16) | ||
716 | #define I2S_CONFIG_PD (1<<11) | ||
717 | #define I2S_CONFIG_LB (1<<10) | ||
718 | #define I2S_CONFIG_IC (1<<9) | ||
719 | #define I2S_CONFIG_FM_BIT 7 | ||
720 | #define I2S_CONFIG_FM_MASK (0x3 << I2S_CONFIG_FM_BIT) | ||
721 | #define I2S_CONFIG_FM_I2S (0x0 << I2S_CONFIG_FM_BIT) | ||
722 | #define I2S_CONFIG_FM_LJ (0x1 << I2S_CONFIG_FM_BIT) | ||
723 | #define I2S_CONFIG_FM_RJ (0x2 << I2S_CONFIG_FM_BIT) | ||
724 | #define I2S_CONFIG_TN (1<<6) | ||
725 | #define I2S_CONFIG_RN (1<<5) | ||
726 | #define I2S_CONFIG_SZ_BIT 0 | ||
727 | #define I2S_CONFIG_SZ_MASK (0x1F << I2S_CONFIG_SZ_BIT) | ||
728 | |||
729 | #define I2S_CONTROL 0xB1000008 | ||
730 | #define I2S_CONTROL_D (1<<1) | ||
731 | #define I2S_CONTROL_CE (1<<0) | ||
732 | |||
733 | /* USB Host Controller */ | ||
734 | #define USB_OHCI_LEN 0x00100000 | ||
735 | |||
736 | /* USB Device Controller */ | ||
737 | #define USBD_EP0RD 0xB0200000 | ||
738 | #define USBD_EP0WR 0xB0200004 | ||
739 | #define USBD_EP2WR 0xB0200008 | ||
740 | #define USBD_EP3WR 0xB020000C | ||
741 | #define USBD_EP4RD 0xB0200010 | ||
742 | #define USBD_EP5RD 0xB0200014 | ||
743 | #define USBD_INTEN 0xB0200018 | ||
744 | #define USBD_INTSTAT 0xB020001C | ||
745 | #define USBDEV_INT_SOF (1<<12) | ||
746 | #define USBDEV_INT_HF_BIT 6 | ||
747 | #define USBDEV_INT_HF_MASK (0x3f << USBDEV_INT_HF_BIT) | ||
748 | #define USBDEV_INT_CMPLT_BIT 0 | ||
749 | #define USBDEV_INT_CMPLT_MASK (0x3f << USBDEV_INT_CMPLT_BIT) | ||
750 | #define USBD_CONFIG 0xB0200020 | ||
751 | #define USBD_EP0CS 0xB0200024 | ||
752 | #define USBD_EP2CS 0xB0200028 | ||
753 | #define USBD_EP3CS 0xB020002C | ||
754 | #define USBD_EP4CS 0xB0200030 | ||
755 | #define USBD_EP5CS 0xB0200034 | ||
756 | #define USBDEV_CS_SU (1<<14) | ||
757 | #define USBDEV_CS_NAK (1<<13) | ||
758 | #define USBDEV_CS_ACK (1<<12) | ||
759 | #define USBDEV_CS_BUSY (1<<11) | ||
760 | #define USBDEV_CS_TSIZE_BIT 1 | ||
761 | #define USBDEV_CS_TSIZE_MASK (0x3ff << USBDEV_CS_TSIZE_BIT) | ||
762 | #define USBDEV_CS_STALL (1<<0) | ||
763 | #define USBD_EP0RDSTAT 0xB0200040 | ||
764 | #define USBD_EP0WRSTAT 0xB0200044 | ||
765 | #define USBD_EP2WRSTAT 0xB0200048 | ||
766 | #define USBD_EP3WRSTAT 0xB020004C | ||
767 | #define USBD_EP4RDSTAT 0xB0200050 | ||
768 | #define USBD_EP5RDSTAT 0xB0200054 | ||
769 | #define USBDEV_FSTAT_FLUSH (1<<6) | ||
770 | #define USBDEV_FSTAT_UF (1<<5) | ||
771 | #define USBDEV_FSTAT_OF (1<<4) | ||
772 | #define USBDEV_FSTAT_FCNT_BIT 0 | ||
773 | #define USBDEV_FSTAT_FCNT_MASK (0x0f << USBDEV_FSTAT_FCNT_BIT) | ||
774 | #define USBD_ENABLE 0xB0200058 | ||
775 | #define USBDEV_ENABLE (1<<1) | ||
776 | #define USBDEV_CE (1<<0) | ||
777 | |||
778 | /* Ethernet Controllers */ | ||
779 | |||
780 | /* 4 byte offsets from AU1000_ETH_BASE */ | ||
781 | #define MAC_CONTROL 0x0 | ||
782 | #define MAC_RX_ENABLE (1<<2) | ||
783 | #define MAC_TX_ENABLE (1<<3) | ||
784 | #define MAC_DEF_CHECK (1<<5) | ||
785 | #define MAC_SET_BL(X) (((X)&0x3)<<6) | ||
786 | #define MAC_AUTO_PAD (1<<8) | ||
787 | #define MAC_DISABLE_RETRY (1<<10) | ||
788 | #define MAC_DISABLE_BCAST (1<<11) | ||
789 | #define MAC_LATE_COL (1<<12) | ||
790 | #define MAC_HASH_MODE (1<<13) | ||
791 | #define MAC_HASH_ONLY (1<<15) | ||
792 | #define MAC_PASS_ALL (1<<16) | ||
793 | #define MAC_INVERSE_FILTER (1<<17) | ||
794 | #define MAC_PROMISCUOUS (1<<18) | ||
795 | #define MAC_PASS_ALL_MULTI (1<<19) | ||
796 | #define MAC_FULL_DUPLEX (1<<20) | ||
797 | #define MAC_NORMAL_MODE 0 | ||
798 | #define MAC_INT_LOOPBACK (1<<21) | ||
799 | #define MAC_EXT_LOOPBACK (1<<22) | ||
800 | #define MAC_DISABLE_RX_OWN (1<<23) | ||
801 | #define MAC_BIG_ENDIAN (1<<30) | ||
802 | #define MAC_RX_ALL (1<<31) | ||
803 | #define MAC_ADDRESS_HIGH 0x4 | ||
804 | #define MAC_ADDRESS_LOW 0x8 | ||
805 | #define MAC_MCAST_HIGH 0xC | ||
806 | #define MAC_MCAST_LOW 0x10 | ||
807 | #define MAC_MII_CNTRL 0x14 | ||
808 | #define MAC_MII_BUSY (1<<0) | ||
809 | #define MAC_MII_READ 0 | ||
810 | #define MAC_MII_WRITE (1<<1) | ||
811 | #define MAC_SET_MII_SELECT_REG(X) (((X)&0x1f)<<6) | ||
812 | #define MAC_SET_MII_SELECT_PHY(X) (((X)&0x1f)<<11) | ||
813 | #define MAC_MII_DATA 0x18 | ||
814 | #define MAC_FLOW_CNTRL 0x1C | ||
815 | #define MAC_FLOW_CNTRL_BUSY (1<<0) | ||
816 | #define MAC_FLOW_CNTRL_ENABLE (1<<1) | ||
817 | #define MAC_PASS_CONTROL (1<<2) | ||
818 | #define MAC_SET_PAUSE(X) (((X)&0xffff)<<16) | ||
819 | #define MAC_VLAN1_TAG 0x20 | ||
820 | #define MAC_VLAN2_TAG 0x24 | ||
821 | |||
822 | /* Ethernet Controller Enable */ | ||
823 | |||
824 | #define MAC_EN_CLOCK_ENABLE (1<<0) | ||
825 | #define MAC_EN_RESET0 (1<<1) | ||
826 | #define MAC_EN_TOSS (0<<2) | ||
827 | #define MAC_EN_CACHEABLE (1<<3) | ||
828 | #define MAC_EN_RESET1 (1<<4) | ||
829 | #define MAC_EN_RESET2 (1<<5) | ||
830 | #define MAC_DMA_RESET (1<<6) | ||
831 | |||
832 | /* Ethernet Controller DMA Channels */ | ||
833 | |||
834 | #define MAC0_TX_DMA_ADDR 0xB4004000 | ||
835 | #define MAC1_TX_DMA_ADDR 0xB4004200 | ||
836 | /* offsets from MAC_TX_RING_ADDR address */ | ||
837 | #define MAC_TX_BUFF0_STATUS 0x0 | ||
838 | #define TX_FRAME_ABORTED (1<<0) | ||
839 | #define TX_JAB_TIMEOUT (1<<1) | ||
840 | #define TX_NO_CARRIER (1<<2) | ||
841 | #define TX_LOSS_CARRIER (1<<3) | ||
842 | #define TX_EXC_DEF (1<<4) | ||
843 | #define TX_LATE_COLL_ABORT (1<<5) | ||
844 | #define TX_EXC_COLL (1<<6) | ||
845 | #define TX_UNDERRUN (1<<7) | ||
846 | #define TX_DEFERRED (1<<8) | ||
847 | #define TX_LATE_COLL (1<<9) | ||
848 | #define TX_COLL_CNT_MASK (0xF<<10) | ||
849 | #define TX_PKT_RETRY (1<<31) | ||
850 | #define MAC_TX_BUFF0_ADDR 0x4 | ||
851 | #define TX_DMA_ENABLE (1<<0) | ||
852 | #define TX_T_DONE (1<<1) | ||
853 | #define TX_GET_DMA_BUFFER(X) (((X)>>2)&0x3) | ||
854 | #define MAC_TX_BUFF0_LEN 0x8 | ||
855 | #define MAC_TX_BUFF1_STATUS 0x10 | ||
856 | #define MAC_TX_BUFF1_ADDR 0x14 | ||
857 | #define MAC_TX_BUFF1_LEN 0x18 | ||
858 | #define MAC_TX_BUFF2_STATUS 0x20 | ||
859 | #define MAC_TX_BUFF2_ADDR 0x24 | ||
860 | #define MAC_TX_BUFF2_LEN 0x28 | ||
861 | #define MAC_TX_BUFF3_STATUS 0x30 | ||
862 | #define MAC_TX_BUFF3_ADDR 0x34 | ||
863 | #define MAC_TX_BUFF3_LEN 0x38 | ||
864 | |||
865 | #define MAC0_RX_DMA_ADDR 0xB4004100 | ||
866 | #define MAC1_RX_DMA_ADDR 0xB4004300 | ||
867 | /* offsets from MAC_RX_RING_ADDR */ | ||
868 | #define MAC_RX_BUFF0_STATUS 0x0 | ||
869 | #define RX_FRAME_LEN_MASK 0x3fff | ||
870 | #define RX_WDOG_TIMER (1<<14) | ||
871 | #define RX_RUNT (1<<15) | ||
872 | #define RX_OVERLEN (1<<16) | ||
873 | #define RX_COLL (1<<17) | ||
874 | #define RX_ETHER (1<<18) | ||
875 | #define RX_MII_ERROR (1<<19) | ||
876 | #define RX_DRIBBLING (1<<20) | ||
877 | #define RX_CRC_ERROR (1<<21) | ||
878 | #define RX_VLAN1 (1<<22) | ||
879 | #define RX_VLAN2 (1<<23) | ||
880 | #define RX_LEN_ERROR (1<<24) | ||
881 | #define RX_CNTRL_FRAME (1<<25) | ||
882 | #define RX_U_CNTRL_FRAME (1<<26) | ||
883 | #define RX_MCAST_FRAME (1<<27) | ||
884 | #define RX_BCAST_FRAME (1<<28) | ||
885 | #define RX_FILTER_FAIL (1<<29) | ||
886 | #define RX_PACKET_FILTER (1<<30) | ||
887 | #define RX_MISSED_FRAME (1<<31) | ||
888 | |||
889 | #define RX_ERROR (RX_WDOG_TIMER | RX_RUNT | RX_OVERLEN | \ | ||
890 | RX_COLL | RX_MII_ERROR | RX_CRC_ERROR | \ | ||
891 | RX_LEN_ERROR | RX_U_CNTRL_FRAME | RX_MISSED_FRAME) | ||
892 | #define MAC_RX_BUFF0_ADDR 0x4 | ||
893 | #define RX_DMA_ENABLE (1<<0) | ||
894 | #define RX_T_DONE (1<<1) | ||
895 | #define RX_GET_DMA_BUFFER(X) (((X)>>2)&0x3) | ||
896 | #define RX_SET_BUFF_ADDR(X) ((X)&0xffffffc0) | ||
897 | #define MAC_RX_BUFF1_STATUS 0x10 | ||
898 | #define MAC_RX_BUFF1_ADDR 0x14 | ||
899 | #define MAC_RX_BUFF2_STATUS 0x20 | ||
900 | #define MAC_RX_BUFF2_ADDR 0x24 | ||
901 | #define MAC_RX_BUFF3_STATUS 0x30 | ||
902 | #define MAC_RX_BUFF3_ADDR 0x34 | ||
903 | |||
904 | |||
905 | /* UARTS 0-3 */ | ||
906 | #define UART_BASE UART0_ADDR | ||
907 | #define UART_DEBUG_BASE UART3_ADDR | ||
908 | |||
909 | #define UART_RX 0 /* Receive buffer */ | ||
910 | #define UART_TX 4 /* Transmit buffer */ | ||
911 | #define UART_IER 8 /* Interrupt Enable Register */ | ||
912 | #define UART_IIR 0xC /* Interrupt ID Register */ | ||
913 | #define UART_FCR 0x10 /* FIFO Control Register */ | ||
914 | #define UART_LCR 0x14 /* Line Control Register */ | ||
915 | #define UART_MCR 0x18 /* Modem Control Register */ | ||
916 | #define UART_LSR 0x1C /* Line Status Register */ | ||
917 | #define UART_MSR 0x20 /* Modem Status Register */ | ||
918 | #define UART_CLK 0x28 /* Baud Rate Clock Divider */ | ||
919 | #define UART_MOD_CNTRL 0x100 /* Module Control */ | ||
920 | |||
921 | #define UART_FCR_ENABLE_FIFO 0x01 /* Enable the FIFO */ | ||
922 | #define UART_FCR_CLEAR_RCVR 0x02 /* Clear the RCVR FIFO */ | ||
923 | #define UART_FCR_CLEAR_XMIT 0x04 /* Clear the XMIT FIFO */ | ||
924 | #define UART_FCR_DMA_SELECT 0x08 /* For DMA applications */ | ||
925 | #define UART_FCR_TRIGGER_MASK 0xF0 /* Mask for the FIFO trigger range */ | ||
926 | #define UART_FCR_R_TRIGGER_1 0x00 /* Mask for receive trigger set at 1 */ | ||
927 | #define UART_FCR_R_TRIGGER_4 0x40 /* Mask for receive trigger set at 4 */ | ||
928 | #define UART_FCR_R_TRIGGER_8 0x80 /* Mask for receive trigger set at 8 */ | ||
929 | #define UART_FCR_R_TRIGGER_14 0xA0 /* Mask for receive trigger set at 14 */ | ||
930 | #define UART_FCR_T_TRIGGER_0 0x00 /* Mask for transmit trigger set at 0 */ | ||
931 | #define UART_FCR_T_TRIGGER_4 0x10 /* Mask for transmit trigger set at 4 */ | ||
932 | #define UART_FCR_T_TRIGGER_8 0x20 /* Mask for transmit trigger set at 8 */ | ||
933 | #define UART_FCR_T_TRIGGER_12 0x30 /* Mask for transmit trigger set at 12 */ | ||
934 | |||
935 | /* | ||
936 | * These are the definitions for the Line Control Register | ||
937 | */ | ||
938 | #define UART_LCR_SBC 0x40 /* Set break control */ | ||
939 | #define UART_LCR_SPAR 0x20 /* Stick parity (?) */ | ||
940 | #define UART_LCR_EPAR 0x10 /* Even parity select */ | ||
941 | #define UART_LCR_PARITY 0x08 /* Parity Enable */ | ||
942 | #define UART_LCR_STOP 0x04 /* Stop bits: 0=1 stop bit, 1= 2 stop bits */ | ||
943 | #define UART_LCR_WLEN5 0x00 /* Wordlength: 5 bits */ | ||
944 | #define UART_LCR_WLEN6 0x01 /* Wordlength: 6 bits */ | ||
945 | #define UART_LCR_WLEN7 0x02 /* Wordlength: 7 bits */ | ||
946 | #define UART_LCR_WLEN8 0x03 /* Wordlength: 8 bits */ | ||
947 | |||
948 | /* | ||
949 | * These are the definitions for the Line Status Register | ||
950 | */ | ||
951 | #define UART_LSR_TEMT 0x40 /* Transmitter empty */ | ||
952 | #define UART_LSR_THRE 0x20 /* Transmit-hold-register empty */ | ||
953 | #define UART_LSR_BI 0x10 /* Break interrupt indicator */ | ||
954 | #define UART_LSR_FE 0x08 /* Frame error indicator */ | ||
955 | #define UART_LSR_PE 0x04 /* Parity error indicator */ | ||
956 | #define UART_LSR_OE 0x02 /* Overrun error indicator */ | ||
957 | #define UART_LSR_DR 0x01 /* Receiver data ready */ | ||
958 | |||
959 | /* | ||
960 | * These are the definitions for the Interrupt Identification Register | ||
961 | */ | ||
962 | #define UART_IIR_NO_INT 0x01 /* No interrupts pending */ | ||
963 | #define UART_IIR_ID 0x06 /* Mask for the interrupt ID */ | ||
964 | #define UART_IIR_MSI 0x00 /* Modem status interrupt */ | ||
965 | #define UART_IIR_THRI 0x02 /* Transmitter holding register empty */ | ||
966 | #define UART_IIR_RDI 0x04 /* Receiver data interrupt */ | ||
967 | #define UART_IIR_RLSI 0x06 /* Receiver line status interrupt */ | ||
968 | |||
969 | /* | ||
970 | * These are the definitions for the Interrupt Enable Register | ||
971 | */ | ||
972 | #define UART_IER_MSI 0x08 /* Enable Modem status interrupt */ | ||
973 | #define UART_IER_RLSI 0x04 /* Enable receiver line status interrupt */ | ||
974 | #define UART_IER_THRI 0x02 /* Enable Transmitter holding register int. */ | ||
975 | #define UART_IER_RDI 0x01 /* Enable receiver data interrupt */ | ||
976 | |||
977 | /* | ||
978 | * These are the definitions for the Modem Control Register | ||
979 | */ | ||
980 | #define UART_MCR_LOOP 0x10 /* Enable loopback test mode */ | ||
981 | #define UART_MCR_OUT2 0x08 /* Out2 complement */ | ||
982 | #define UART_MCR_OUT1 0x04 /* Out1 complement */ | ||
983 | #define UART_MCR_RTS 0x02 /* RTS complement */ | ||
984 | #define UART_MCR_DTR 0x01 /* DTR complement */ | ||
985 | |||
986 | /* | ||
987 | * These are the definitions for the Modem Status Register | ||
988 | */ | ||
989 | #define UART_MSR_DCD 0x80 /* Data Carrier Detect */ | ||
990 | #define UART_MSR_RI 0x40 /* Ring Indicator */ | ||
991 | #define UART_MSR_DSR 0x20 /* Data Set Ready */ | ||
992 | #define UART_MSR_CTS 0x10 /* Clear to Send */ | ||
993 | #define UART_MSR_DDCD 0x08 /* Delta DCD */ | ||
994 | #define UART_MSR_TERI 0x04 /* Trailing edge ring indicator */ | ||
995 | #define UART_MSR_DDSR 0x02 /* Delta DSR */ | ||
996 | #define UART_MSR_DCTS 0x01 /* Delta CTS */ | ||
997 | #define UART_MSR_ANY_DELTA 0x0F /* Any of the delta bits! */ | ||
998 | |||
999 | |||
1000 | |||
1001 | /* SSIO */ | ||
1002 | #define SSI0_STATUS 0xB1600000 | ||
1003 | #define SSI_STATUS_BF (1<<4) | ||
1004 | #define SSI_STATUS_OF (1<<3) | ||
1005 | #define SSI_STATUS_UF (1<<2) | ||
1006 | #define SSI_STATUS_D (1<<1) | ||
1007 | #define SSI_STATUS_B (1<<0) | ||
1008 | #define SSI0_INT 0xB1600004 | ||
1009 | #define SSI_INT_OI (1<<3) | ||
1010 | #define SSI_INT_UI (1<<2) | ||
1011 | #define SSI_INT_DI (1<<1) | ||
1012 | #define SSI0_INT_ENABLE 0xB1600008 | ||
1013 | #define SSI_INTE_OIE (1<<3) | ||
1014 | #define SSI_INTE_UIE (1<<2) | ||
1015 | #define SSI_INTE_DIE (1<<1) | ||
1016 | #define SSI0_CONFIG 0xB1600020 | ||
1017 | #define SSI_CONFIG_AO (1<<24) | ||
1018 | #define SSI_CONFIG_DO (1<<23) | ||
1019 | #define SSI_CONFIG_ALEN_BIT 20 | ||
1020 | #define SSI_CONFIG_ALEN_MASK (0x7<<20) | ||
1021 | #define SSI_CONFIG_DLEN_BIT 16 | ||
1022 | #define SSI_CONFIG_DLEN_MASK (0x7<<16) | ||
1023 | #define SSI_CONFIG_DD (1<<11) | ||
1024 | #define SSI_CONFIG_AD (1<<10) | ||
1025 | #define SSI_CONFIG_BM_BIT 8 | ||
1026 | #define SSI_CONFIG_BM_MASK (0x3<<8) | ||
1027 | #define SSI_CONFIG_CE (1<<7) | ||
1028 | #define SSI_CONFIG_DP (1<<6) | ||
1029 | #define SSI_CONFIG_DL (1<<5) | ||
1030 | #define SSI_CONFIG_EP (1<<4) | ||
1031 | #define SSI0_ADATA 0xB1600024 | ||
1032 | #define SSI_AD_D (1<<24) | ||
1033 | #define SSI_AD_ADDR_BIT 16 | ||
1034 | #define SSI_AD_ADDR_MASK (0xff<<16) | ||
1035 | #define SSI_AD_DATA_BIT 0 | ||
1036 | #define SSI_AD_DATA_MASK (0xfff<<0) | ||
1037 | #define SSI0_CLKDIV 0xB1600028 | ||
1038 | #define SSI0_CONTROL 0xB1600100 | ||
1039 | #define SSI_CONTROL_CD (1<<1) | ||
1040 | #define SSI_CONTROL_E (1<<0) | ||
1041 | |||
1042 | /* SSI1 */ | ||
1043 | #define SSI1_STATUS 0xB1680000 | ||
1044 | #define SSI1_INT 0xB1680004 | ||
1045 | #define SSI1_INT_ENABLE 0xB1680008 | ||
1046 | #define SSI1_CONFIG 0xB1680020 | ||
1047 | #define SSI1_ADATA 0xB1680024 | ||
1048 | #define SSI1_CLKDIV 0xB1680028 | ||
1049 | #define SSI1_ENABLE 0xB1680100 | ||
1050 | |||
1051 | /* | ||
1052 | * Register content definitions | ||
1053 | */ | ||
1054 | #define SSI_STATUS_BF (1<<4) | ||
1055 | #define SSI_STATUS_OF (1<<3) | ||
1056 | #define SSI_STATUS_UF (1<<2) | ||
1057 | #define SSI_STATUS_D (1<<1) | ||
1058 | #define SSI_STATUS_B (1<<0) | ||
1059 | |||
1060 | /* SSI_INT */ | ||
1061 | #define SSI_INT_OI (1<<3) | ||
1062 | #define SSI_INT_UI (1<<2) | ||
1063 | #define SSI_INT_DI (1<<1) | ||
1064 | |||
1065 | /* SSI_INTEN */ | ||
1066 | #define SSI_INTEN_OIE (1<<3) | ||
1067 | #define SSI_INTEN_UIE (1<<2) | ||
1068 | #define SSI_INTEN_DIE (1<<1) | ||
1069 | |||
1070 | #define SSI_CONFIG_AO (1<<24) | ||
1071 | #define SSI_CONFIG_DO (1<<23) | ||
1072 | #define SSI_CONFIG_ALEN (7<<20) | ||
1073 | #define SSI_CONFIG_DLEN (15<<16) | ||
1074 | #define SSI_CONFIG_DD (1<<11) | ||
1075 | #define SSI_CONFIG_AD (1<<10) | ||
1076 | #define SSI_CONFIG_BM (3<<8) | ||
1077 | #define SSI_CONFIG_CE (1<<7) | ||
1078 | #define SSI_CONFIG_DP (1<<6) | ||
1079 | #define SSI_CONFIG_DL (1<<5) | ||
1080 | #define SSI_CONFIG_EP (1<<4) | ||
1081 | #define SSI_CONFIG_ALEN_N(N) ((N-1)<<20) | ||
1082 | #define SSI_CONFIG_DLEN_N(N) ((N-1)<<16) | ||
1083 | #define SSI_CONFIG_BM_HI (0<<8) | ||
1084 | #define SSI_CONFIG_BM_LO (1<<8) | ||
1085 | #define SSI_CONFIG_BM_CY (2<<8) | ||
1086 | |||
1087 | #define SSI_ADATA_D (1<<24) | ||
1088 | #define SSI_ADATA_ADDR (0xFF<<16) | ||
1089 | #define SSI_ADATA_DATA (0x0FFF) | ||
1090 | #define SSI_ADATA_ADDR_N(N) (N<<16) | ||
1091 | |||
1092 | #define SSI_ENABLE_CD (1<<1) | ||
1093 | #define SSI_ENABLE_E (1<<0) | ||
1094 | |||
1095 | |||
1096 | /* IrDA Controller */ | ||
1097 | #define IRDA_BASE 0xB0300000 | ||
1098 | #define IR_RING_PTR_STATUS (IRDA_BASE+0x00) | ||
1099 | #define IR_RING_BASE_ADDR_H (IRDA_BASE+0x04) | ||
1100 | #define IR_RING_BASE_ADDR_L (IRDA_BASE+0x08) | ||
1101 | #define IR_RING_SIZE (IRDA_BASE+0x0C) | ||
1102 | #define IR_RING_PROMPT (IRDA_BASE+0x10) | ||
1103 | #define IR_RING_ADDR_CMPR (IRDA_BASE+0x14) | ||
1104 | #define IR_INT_CLEAR (IRDA_BASE+0x18) | ||
1105 | #define IR_CONFIG_1 (IRDA_BASE+0x20) | ||
1106 | #define IR_RX_INVERT_LED (1<<0) | ||
1107 | #define IR_TX_INVERT_LED (1<<1) | ||
1108 | #define IR_ST (1<<2) | ||
1109 | #define IR_SF (1<<3) | ||
1110 | #define IR_SIR (1<<4) | ||
1111 | #define IR_MIR (1<<5) | ||
1112 | #define IR_FIR (1<<6) | ||
1113 | #define IR_16CRC (1<<7) | ||
1114 | #define IR_TD (1<<8) | ||
1115 | #define IR_RX_ALL (1<<9) | ||
1116 | #define IR_DMA_ENABLE (1<<10) | ||
1117 | #define IR_RX_ENABLE (1<<11) | ||
1118 | #define IR_TX_ENABLE (1<<12) | ||
1119 | #define IR_LOOPBACK (1<<14) | ||
1120 | #define IR_SIR_MODE (IR_SIR | IR_DMA_ENABLE | \ | ||
1121 | IR_RX_ALL | IR_RX_ENABLE | IR_SF | IR_16CRC) | ||
1122 | #define IR_SIR_FLAGS (IRDA_BASE+0x24) | ||
1123 | #define IR_ENABLE (IRDA_BASE+0x28) | ||
1124 | #define IR_RX_STATUS (1<<9) | ||
1125 | #define IR_TX_STATUS (1<<10) | ||
1126 | #define IR_READ_PHY_CONFIG (IRDA_BASE+0x2C) | ||
1127 | #define IR_WRITE_PHY_CONFIG (IRDA_BASE+0x30) | ||
1128 | #define IR_MAX_PKT_LEN (IRDA_BASE+0x34) | ||
1129 | #define IR_RX_BYTE_CNT (IRDA_BASE+0x38) | ||
1130 | #define IR_CONFIG_2 (IRDA_BASE+0x3C) | ||
1131 | #define IR_MODE_INV (1<<0) | ||
1132 | #define IR_ONE_PIN (1<<1) | ||
1133 | #define IR_INTERFACE_CONFIG (IRDA_BASE+0x40) | ||
1134 | |||
1135 | /* GPIO */ | ||
1136 | #define SYS_PINFUNC 0xB190002C | ||
1137 | #define SYS_PF_USB (1<<15) /* 2nd USB device/host */ | ||
1138 | #define SYS_PF_U3 (1<<14) /* GPIO23/U3TXD */ | ||
1139 | #define SYS_PF_U2 (1<<13) /* GPIO22/U2TXD */ | ||
1140 | #define SYS_PF_U1 (1<<12) /* GPIO21/U1TXD */ | ||
1141 | #define SYS_PF_SRC (1<<11) /* GPIO6/SROMCKE */ | ||
1142 | #define SYS_PF_CK5 (1<<10) /* GPIO3/CLK5 */ | ||
1143 | #define SYS_PF_CK4 (1<<9) /* GPIO2/CLK4 */ | ||
1144 | #define SYS_PF_IRF (1<<8) /* GPIO15/IRFIRSEL */ | ||
1145 | #define SYS_PF_UR3 (1<<7) /* GPIO[14:9]/UART3 */ | ||
1146 | #define SYS_PF_I2D (1<<6) /* GPIO8/I2SDI */ | ||
1147 | #define SYS_PF_I2S (1<<5) /* I2S/GPIO[29:31] */ | ||
1148 | #define SYS_PF_NI2 (1<<4) /* NI2/GPIO[24:28] */ | ||
1149 | #define SYS_PF_U0 (1<<3) /* U0TXD/GPIO20 */ | ||
1150 | #define SYS_PF_RD (1<<2) /* IRTXD/GPIO19 */ | ||
1151 | #define SYS_PF_A97 (1<<1) /* AC97/SSL1 */ | ||
1152 | #define SYS_PF_S0 (1<<0) /* SSI_0/GPIO[16:18] */ | ||
1153 | |||
1154 | /* Au1100 Only */ | ||
1155 | #define SYS_PF_PC (1<<18) /* PCMCIA/GPIO[207:204] */ | ||
1156 | #define SYS_PF_LCD (1<<17) /* extern lcd/GPIO[203:200] */ | ||
1157 | #define SYS_PF_CS (1<<16) /* EXTCLK0/32khz to gpio2 */ | ||
1158 | #define SYS_PF_EX0 (1<<9) /* gpio2/clock */ | ||
1159 | |||
1160 | /* Au1550 Only. Redefines lots of pins */ | ||
1161 | #define SYS_PF_PSC2_MASK (7 << 17) | ||
1162 | #define SYS_PF_PSC2_AC97 (0) | ||
1163 | #define SYS_PF_PSC2_SPI (0) | ||
1164 | #define SYS_PF_PSC2_I2S (1 << 17) | ||
1165 | #define SYS_PF_PSC2_SMBUS (3 << 17) | ||
1166 | #define SYS_PF_PSC2_GPIO (7 << 17) | ||
1167 | #define SYS_PF_PSC3_MASK (7 << 20) | ||
1168 | #define SYS_PF_PSC3_AC97 (0) | ||
1169 | #define SYS_PF_PSC3_SPI (0) | ||
1170 | #define SYS_PF_PSC3_I2S (1 << 20) | ||
1171 | #define SYS_PF_PSC3_SMBUS (3 << 20) | ||
1172 | #define SYS_PF_PSC3_GPIO (7 << 20) | ||
1173 | #define SYS_PF_PSC1_S1 (1 << 1) | ||
1174 | #define SYS_PF_MUST_BE_SET ((1 << 5) | (1 << 2)) | ||
1175 | |||
1176 | #define SYS_TRIOUTRD 0xB1900100 | ||
1177 | #define SYS_TRIOUTCLR 0xB1900100 | ||
1178 | #define SYS_OUTPUTRD 0xB1900108 | ||
1179 | #define SYS_OUTPUTSET 0xB1900108 | ||
1180 | #define SYS_OUTPUTCLR 0xB190010C | ||
1181 | #define SYS_PINSTATERD 0xB1900110 | ||
1182 | #define SYS_PININPUTEN 0xB1900110 | ||
1183 | |||
1184 | /* GPIO2, Au1500, Au1550 only */ | ||
1185 | #define GPIO2_BASE 0xB1700000 | ||
1186 | #define GPIO2_DIR (GPIO2_BASE + 0) | ||
1187 | #define GPIO2_OUTPUT (GPIO2_BASE + 8) | ||
1188 | #define GPIO2_PINSTATE (GPIO2_BASE + 0xC) | ||
1189 | #define GPIO2_INTENABLE (GPIO2_BASE + 0x10) | ||
1190 | #define GPIO2_ENABLE (GPIO2_BASE + 0x14) | ||
1191 | |||
1192 | /* Power Management */ | ||
1193 | #define SYS_SCRATCH0 0xB1900018 | ||
1194 | #define SYS_SCRATCH1 0xB190001C | ||
1195 | #define SYS_WAKEMSK 0xB1900034 | ||
1196 | #define SYS_ENDIAN 0xB1900038 | ||
1197 | #define SYS_POWERCTRL 0xB190003C | ||
1198 | #define SYS_WAKESRC 0xB190005C | ||
1199 | #define SYS_SLPPWR 0xB1900078 | ||
1200 | #define SYS_SLEEP 0xB190007C | ||
1201 | |||
1202 | /* Clock Controller */ | ||
1203 | #define SYS_FREQCTRL0 0xB1900020 | ||
1204 | #define SYS_FC_FRDIV2_BIT 22 | ||
1205 | #define SYS_FC_FRDIV2_MASK (0xff << SYS_FC_FRDIV2_BIT) | ||
1206 | #define SYS_FC_FE2 (1<<21) | ||
1207 | #define SYS_FC_FS2 (1<<20) | ||
1208 | #define SYS_FC_FRDIV1_BIT 12 | ||
1209 | #define SYS_FC_FRDIV1_MASK (0xff << SYS_FC_FRDIV1_BIT) | ||
1210 | #define SYS_FC_FE1 (1<<11) | ||
1211 | #define SYS_FC_FS1 (1<<10) | ||
1212 | #define SYS_FC_FRDIV0_BIT 2 | ||
1213 | #define SYS_FC_FRDIV0_MASK (0xff << SYS_FC_FRDIV0_BIT) | ||
1214 | #define SYS_FC_FE0 (1<<1) | ||
1215 | #define SYS_FC_FS0 (1<<0) | ||
1216 | #define SYS_FREQCTRL1 0xB1900024 | ||
1217 | #define SYS_FC_FRDIV5_BIT 22 | ||
1218 | #define SYS_FC_FRDIV5_MASK (0xff << SYS_FC_FRDIV5_BIT) | ||
1219 | #define SYS_FC_FE5 (1<<21) | ||
1220 | #define SYS_FC_FS5 (1<<20) | ||
1221 | #define SYS_FC_FRDIV4_BIT 12 | ||
1222 | #define SYS_FC_FRDIV4_MASK (0xff << SYS_FC_FRDIV4_BIT) | ||
1223 | #define SYS_FC_FE4 (1<<11) | ||
1224 | #define SYS_FC_FS4 (1<<10) | ||
1225 | #define SYS_FC_FRDIV3_BIT 2 | ||
1226 | #define SYS_FC_FRDIV3_MASK (0xff << SYS_FC_FRDIV3_BIT) | ||
1227 | #define SYS_FC_FE3 (1<<1) | ||
1228 | #define SYS_FC_FS3 (1<<0) | ||
1229 | #define SYS_CLKSRC 0xB1900028 | ||
1230 | #define SYS_CS_ME1_BIT 27 | ||
1231 | #define SYS_CS_ME1_MASK (0x7<<SYS_CS_ME1_BIT) | ||
1232 | #define SYS_CS_DE1 (1<<26) | ||
1233 | #define SYS_CS_CE1 (1<<25) | ||
1234 | #define SYS_CS_ME0_BIT 22 | ||
1235 | #define SYS_CS_ME0_MASK (0x7<<SYS_CS_ME0_BIT) | ||
1236 | #define SYS_CS_DE0 (1<<21) | ||
1237 | #define SYS_CS_CE0 (1<<20) | ||
1238 | #define SYS_CS_MI2_BIT 17 | ||
1239 | #define SYS_CS_MI2_MASK (0x7<<SYS_CS_MI2_BIT) | ||
1240 | #define SYS_CS_DI2 (1<<16) | ||
1241 | #define SYS_CS_CI2 (1<<15) | ||
1242 | #define SYS_CS_MUH_BIT 12 | ||
1243 | #define SYS_CS_MUH_MASK (0x7<<SYS_CS_MUH_BIT) | ||
1244 | #define SYS_CS_DUH (1<<11) | ||
1245 | #define SYS_CS_CUH (1<<10) | ||
1246 | #define SYS_CS_MUD_BIT 7 | ||
1247 | #define SYS_CS_MUD_MASK (0x7<<SYS_CS_MUD_BIT) | ||
1248 | #define SYS_CS_DUD (1<<6) | ||
1249 | #define SYS_CS_CUD (1<<5) | ||
1250 | #define SYS_CS_MIR_BIT 2 | ||
1251 | #define SYS_CS_MIR_MASK (0x7<<SYS_CS_MIR_BIT) | ||
1252 | #define SYS_CS_DIR (1<<1) | ||
1253 | #define SYS_CS_CIR (1<<0) | ||
1254 | |||
1255 | #define SYS_CS_MUX_AUX 0x1 | ||
1256 | #define SYS_CS_MUX_FQ0 0x2 | ||
1257 | #define SYS_CS_MUX_FQ1 0x3 | ||
1258 | #define SYS_CS_MUX_FQ2 0x4 | ||
1259 | #define SYS_CS_MUX_FQ3 0x5 | ||
1260 | #define SYS_CS_MUX_FQ4 0x6 | ||
1261 | #define SYS_CS_MUX_FQ5 0x7 | ||
1262 | #define SYS_CPUPLL 0xB1900060 | ||
1263 | #define SYS_AUXPLL 0xB1900064 | ||
1264 | |||
1265 | /* AC97 Controller */ | ||
1266 | #define AC97C_CONFIG 0xB0000000 | ||
1267 | #define AC97C_RECV_SLOTS_BIT 13 | ||
1268 | #define AC97C_RECV_SLOTS_MASK (0x3ff << AC97C_RECV_SLOTS_BIT) | ||
1269 | #define AC97C_XMIT_SLOTS_BIT 3 | ||
1270 | #define AC97C_XMIT_SLOTS_MASK (0x3ff << AC97C_XMIT_SLOTS_BIT) | ||
1271 | #define AC97C_SG (1<<2) | ||
1272 | #define AC97C_SYNC (1<<1) | ||
1273 | #define AC97C_RESET (1<<0) | ||
1274 | #define AC97C_STATUS 0xB0000004 | ||
1275 | #define AC97C_XU (1<<11) | ||
1276 | #define AC97C_XO (1<<10) | ||
1277 | #define AC97C_RU (1<<9) | ||
1278 | #define AC97C_RO (1<<8) | ||
1279 | #define AC97C_READY (1<<7) | ||
1280 | #define AC97C_CP (1<<6) | ||
1281 | #define AC97C_TR (1<<5) | ||
1282 | #define AC97C_TE (1<<4) | ||
1283 | #define AC97C_TF (1<<3) | ||
1284 | #define AC97C_RR (1<<2) | ||
1285 | #define AC97C_RE (1<<1) | ||
1286 | #define AC97C_RF (1<<0) | ||
1287 | #define AC97C_DATA 0xB0000008 | ||
1288 | #define AC97C_CMD 0xB000000C | ||
1289 | #define AC97C_WD_BIT 16 | ||
1290 | #define AC97C_READ (1<<7) | ||
1291 | #define AC97C_INDEX_MASK 0x7f | ||
1292 | #define AC97C_CNTRL 0xB0000010 | ||
1293 | #define AC97C_RS (1<<1) | ||
1294 | #define AC97C_CE (1<<0) | ||
1295 | |||
1296 | |||
1297 | /* Secure Digital (SD) Controller */ | ||
1298 | #define SD0_XMIT_FIFO 0xB0600000 | ||
1299 | #define SD0_RECV_FIFO 0xB0600004 | ||
1300 | #define SD1_XMIT_FIFO 0xB0680000 | ||
1301 | #define SD1_RECV_FIFO 0xB0680004 | ||
1302 | |||
1303 | |||
1304 | #if defined (CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550) | ||
1305 | /* Au1500 PCI Controller */ | ||
1306 | #define Au1500_CFG_BASE 0xB4005000 // virtual, kseg0 addr | ||
1307 | #define Au1500_PCI_CMEM (Au1500_CFG_BASE + 0) | ||
1308 | #define Au1500_PCI_CFG (Au1500_CFG_BASE + 4) | ||
1309 | #define PCI_ERROR ((1<<22) | (1<<23) | (1<<24) | (1<<25) | (1<<26) | (1<<27)) | ||
1310 | #define Au1500_PCI_B2BMASK_CCH (Au1500_CFG_BASE + 8) | ||
1311 | #define Au1500_PCI_B2B0_VID (Au1500_CFG_BASE + 0xC) | ||
1312 | #define Au1500_PCI_B2B1_ID (Au1500_CFG_BASE + 0x10) | ||
1313 | #define Au1500_PCI_MWMASK_DEV (Au1500_CFG_BASE + 0x14) | ||
1314 | #define Au1500_PCI_MWBASE_REV_CCL (Au1500_CFG_BASE + 0x18) | ||
1315 | #define Au1500_PCI_ERR_ADDR (Au1500_CFG_BASE + 0x1C) | ||
1316 | #define Au1500_PCI_SPEC_INTACK (Au1500_CFG_BASE + 0x20) | ||
1317 | #define Au1500_PCI_ID (Au1500_CFG_BASE + 0x100) | ||
1318 | #define Au1500_PCI_STATCMD (Au1500_CFG_BASE + 0x104) | ||
1319 | #define Au1500_PCI_CLASSREV (Au1500_CFG_BASE + 0x108) | ||
1320 | #define Au1500_PCI_HDRTYPE (Au1500_CFG_BASE + 0x10C) | ||
1321 | #define Au1500_PCI_MBAR (Au1500_CFG_BASE + 0x110) | ||
1322 | |||
1323 | #define Au1500_PCI_HDR 0xB4005100 // virtual, kseg0 addr | ||
1324 | |||
1325 | /* All of our structures, like pci resource, have 32 bit members. | ||
1326 | * Drivers are expected to do an ioremap on the PCI MEM resource, but it's | ||
1327 | * hard to store 0x4 0000 0000 in a 32 bit type. We require a small patch | ||
1328 | * to __ioremap to check for addresses between (u32)Au1500_PCI_MEM_START and | ||
1329 | * (u32)Au1500_PCI_MEM_END and change those to the full 36 bit PCI MEM | ||
1330 | * addresses. For PCI IO, it's simpler because we get to do the ioremap | ||
1331 | * ourselves and then adjust the device's resources. | ||
1332 | */ | ||
1333 | #define Au1500_EXT_CFG 0x600000000ULL | ||
1334 | #define Au1500_EXT_CFG_TYPE1 0x680000000ULL | ||
1335 | #define Au1500_PCI_IO_START 0x500000000ULL | ||
1336 | #define Au1500_PCI_IO_END 0x5000FFFFFULL | ||
1337 | #define Au1500_PCI_MEM_START 0x440000000ULL | ||
1338 | #define Au1500_PCI_MEM_END 0x44FFFFFFFULL | ||
1339 | |||
1340 | #define PCI_IO_START (Au1500_PCI_IO_START + 0x1000) | ||
1341 | #define PCI_IO_END (Au1500_PCI_IO_END) | ||
1342 | #define PCI_MEM_START (Au1500_PCI_MEM_START) | ||
1343 | #define PCI_MEM_END (Au1500_PCI_MEM_END) | ||
1344 | #define PCI_FIRST_DEVFN (0<<3) | ||
1345 | #define PCI_LAST_DEVFN (19<<3) | ||
1346 | |||
1347 | #define IOPORT_RESOURCE_START 0x00001000 /* skip legacy probing */ | ||
1348 | #define IOPORT_RESOURCE_END 0xffffffff | ||
1349 | #define IOMEM_RESOURCE_START 0x10000000 | ||
1350 | #define IOMEM_RESOURCE_END 0xffffffff | ||
1351 | |||
1352 | /* | ||
1353 | * Borrowed from the PPC arch: | ||
1354 | * The following macro is used to lookup irqs in a standard table | ||
1355 | * format for those PPC systems that do not already have PCI | ||
1356 | * interrupts properly routed. | ||
1357 | */ | ||
1358 | /* FIXME - double check this from asm-ppc/pci-bridge.h */ | ||
1359 | #define PCI_IRQ_TABLE_LOOKUP \ | ||
1360 | ({ long _ctl_ = -1; \ | ||
1361 | if (idsel >= min_idsel && idsel <= max_idsel && pin <= irqs_per_slot) \ | ||
1362 | _ctl_ = pci_irq_table[idsel - min_idsel][pin-1]; \ | ||
1363 | _ctl_; }) | ||
1364 | |||
1365 | |||
1366 | #else /* Au1000 and Au1100 */ | ||
1367 | |||
1368 | /* don't allow any legacy ports probing */ | ||
1369 | #define IOPORT_RESOURCE_START 0x10000000; | ||
1370 | #define IOPORT_RESOURCE_END 0xffffffff | ||
1371 | #define IOMEM_RESOURCE_START 0x10000000 | ||
1372 | #define IOMEM_RESOURCE_END 0xffffffff | ||
1373 | |||
1374 | #ifdef CONFIG_MIPS_PB1000 | ||
1375 | #define PCI_IO_START 0x10000000 | ||
1376 | #define PCI_IO_END 0x1000ffff | ||
1377 | #define PCI_MEM_START 0x18000000 | ||
1378 | #define PCI_MEM_END 0x18ffffff | ||
1379 | #define PCI_FIRST_DEVFN 0 | ||
1380 | #define PCI_LAST_DEVFN 1 | ||
1381 | #else | ||
1382 | /* no PCI bus controller */ | ||
1383 | #define PCI_IO_START 0 | ||
1384 | #define PCI_IO_END 0 | ||
1385 | #define PCI_MEM_START 0 | ||
1386 | #define PCI_MEM_END 0 | ||
1387 | #define PCI_FIRST_DEVFN 0 | ||
1388 | #define PCI_LAST_DEVFN 0 | ||
1389 | #endif | ||
1390 | |||
1391 | #endif | ||
1392 | |||
1393 | /* Processor information base on prid. | ||
1394 | * Copied from PowerPC. | ||
1395 | */ | ||
1396 | struct cpu_spec { | ||
1397 | /* CPU is matched via (PRID & prid_mask) == prid_value */ | ||
1398 | unsigned int prid_mask; | ||
1399 | unsigned int prid_value; | ||
1400 | |||
1401 | char *cpu_name; | ||
1402 | unsigned char cpu_od; /* Set Config[OD] */ | ||
1403 | unsigned char cpu_bclk; /* Enable BCLK switching */ | ||
1404 | }; | ||
1405 | |||
1406 | extern struct cpu_spec cpu_specs[]; | ||
1407 | extern struct cpu_spec *cur_cpu_spec[]; | ||
1408 | #endif | ||
diff --git a/include/asm-mips/mach-au1x00/au1000_dma.h b/include/asm-mips/mach-au1x00/au1000_dma.h new file mode 100644 index 000000000000..810f2fa33444 --- /dev/null +++ b/include/asm-mips/mach-au1x00/au1000_dma.h | |||
@@ -0,0 +1,446 @@ | |||
1 | /* | ||
2 | * BRIEF MODULE DESCRIPTION | ||
3 | * Defines for using and allocating dma channels on the Alchemy | ||
4 | * Au1000 mips processor. | ||
5 | * | ||
6 | * Copyright 2000 MontaVista Software Inc. | ||
7 | * Author: MontaVista Software, Inc. | ||
8 | * stevel@mvista.com or source@mvista.com | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License as published by the | ||
12 | * Free Software Foundation; either version 2 of the License, or (at your | ||
13 | * option) any later version. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
16 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
17 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
18 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
21 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
22 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | * You should have received a copy of the GNU General Public License along | ||
27 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
28 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
29 | * | ||
30 | */ | ||
31 | #ifndef __ASM_AU1000_DMA_H | ||
32 | #define __ASM_AU1000_DMA_H | ||
33 | |||
34 | #include <asm/io.h> /* need byte IO */ | ||
35 | #include <linux/spinlock.h> /* And spinlocks */ | ||
36 | #include <linux/delay.h> | ||
37 | #include <asm/system.h> | ||
38 | |||
39 | #define NUM_AU1000_DMA_CHANNELS 8 | ||
40 | |||
41 | /* DMA Channel Base Addresses */ | ||
42 | #define DMA_CHANNEL_BASE 0xB4002000 | ||
43 | #define DMA_CHANNEL_LEN 0x00000100 | ||
44 | |||
45 | /* DMA Channel Register Offsets */ | ||
46 | #define DMA_MODE_SET 0x00000000 | ||
47 | #define DMA_MODE_READ DMA_MODE_SET | ||
48 | #define DMA_MODE_CLEAR 0x00000004 | ||
49 | /* DMA Mode register bits follow */ | ||
50 | #define DMA_DAH_MASK (0x0f << 20) | ||
51 | #define DMA_DID_BIT 16 | ||
52 | #define DMA_DID_MASK (0x0f << DMA_DID_BIT) | ||
53 | #define DMA_DS (1<<15) | ||
54 | #define DMA_BE (1<<13) | ||
55 | #define DMA_DR (1<<12) | ||
56 | #define DMA_TS8 (1<<11) | ||
57 | #define DMA_DW_BIT 9 | ||
58 | #define DMA_DW_MASK (0x03 << DMA_DW_BIT) | ||
59 | #define DMA_DW8 (0 << DMA_DW_BIT) | ||
60 | #define DMA_DW16 (1 << DMA_DW_BIT) | ||
61 | #define DMA_DW32 (2 << DMA_DW_BIT) | ||
62 | #define DMA_NC (1<<8) | ||
63 | #define DMA_IE (1<<7) | ||
64 | #define DMA_HALT (1<<6) | ||
65 | #define DMA_GO (1<<5) | ||
66 | #define DMA_AB (1<<4) | ||
67 | #define DMA_D1 (1<<3) | ||
68 | #define DMA_BE1 (1<<2) | ||
69 | #define DMA_D0 (1<<1) | ||
70 | #define DMA_BE0 (1<<0) | ||
71 | |||
72 | #define DMA_PERIPHERAL_ADDR 0x00000008 | ||
73 | #define DMA_BUFFER0_START 0x0000000C | ||
74 | #define DMA_BUFFER1_START 0x00000014 | ||
75 | #define DMA_BUFFER0_COUNT 0x00000010 | ||
76 | #define DMA_BUFFER1_COUNT 0x00000018 | ||
77 | #define DMA_BAH_BIT 16 | ||
78 | #define DMA_BAH_MASK (0x0f << DMA_BAH_BIT) | ||
79 | #define DMA_COUNT_BIT 0 | ||
80 | #define DMA_COUNT_MASK (0xffff << DMA_COUNT_BIT) | ||
81 | |||
82 | /* DMA Device ID's follow */ | ||
83 | enum { | ||
84 | DMA_ID_UART0_TX = 0, | ||
85 | DMA_ID_UART0_RX, | ||
86 | DMA_ID_GP04, | ||
87 | DMA_ID_GP05, | ||
88 | DMA_ID_AC97C_TX, | ||
89 | DMA_ID_AC97C_RX, | ||
90 | DMA_ID_UART3_TX, | ||
91 | DMA_ID_UART3_RX, | ||
92 | DMA_ID_USBDEV_EP0_RX, | ||
93 | DMA_ID_USBDEV_EP0_TX, | ||
94 | DMA_ID_USBDEV_EP2_TX, | ||
95 | DMA_ID_USBDEV_EP3_TX, | ||
96 | DMA_ID_USBDEV_EP4_RX, | ||
97 | DMA_ID_USBDEV_EP5_RX, | ||
98 | DMA_ID_I2S_TX, | ||
99 | DMA_ID_I2S_RX, | ||
100 | DMA_NUM_DEV | ||
101 | }; | ||
102 | |||
103 | /* DMA Device ID's for 2nd bank (AU1100) follow */ | ||
104 | enum { | ||
105 | DMA_ID_SD0_TX = 0, | ||
106 | DMA_ID_SD0_RX, | ||
107 | DMA_ID_SD1_TX, | ||
108 | DMA_ID_SD1_RX, | ||
109 | DMA_NUM_DEV_BANK2 | ||
110 | }; | ||
111 | |||
112 | struct dma_chan { | ||
113 | int dev_id; // this channel is allocated if >=0, free otherwise | ||
114 | unsigned int io; | ||
115 | const char *dev_str; | ||
116 | int irq; | ||
117 | void *irq_dev; | ||
118 | unsigned int fifo_addr; | ||
119 | unsigned int mode; | ||
120 | }; | ||
121 | |||
122 | /* These are in arch/mips/au1000/common/dma.c */ | ||
123 | extern struct dma_chan au1000_dma_table[]; | ||
124 | extern int request_au1000_dma(int dev_id, | ||
125 | const char *dev_str, | ||
126 | irqreturn_t (*irqhandler)(int, void *, | ||
127 | struct pt_regs *), | ||
128 | unsigned long irqflags, | ||
129 | void *irq_dev_id); | ||
130 | extern void free_au1000_dma(unsigned int dmanr); | ||
131 | extern int au1000_dma_read_proc(char *buf, char **start, off_t fpos, | ||
132 | int length, int *eof, void *data); | ||
133 | extern void dump_au1000_dma_channel(unsigned int dmanr); | ||
134 | extern spinlock_t au1000_dma_spin_lock; | ||
135 | |||
136 | |||
137 | static __inline__ struct dma_chan *get_dma_chan(unsigned int dmanr) | ||
138 | { | ||
139 | if (dmanr >= NUM_AU1000_DMA_CHANNELS | ||
140 | || au1000_dma_table[dmanr].dev_id < 0) | ||
141 | return NULL; | ||
142 | return &au1000_dma_table[dmanr]; | ||
143 | } | ||
144 | |||
145 | static __inline__ unsigned long claim_dma_lock(void) | ||
146 | { | ||
147 | unsigned long flags; | ||
148 | spin_lock_irqsave(&au1000_dma_spin_lock, flags); | ||
149 | return flags; | ||
150 | } | ||
151 | |||
152 | static __inline__ void release_dma_lock(unsigned long flags) | ||
153 | { | ||
154 | spin_unlock_irqrestore(&au1000_dma_spin_lock, flags); | ||
155 | } | ||
156 | |||
157 | /* | ||
158 | * Set the DMA buffer enable bits in the mode register. | ||
159 | */ | ||
160 | static __inline__ void enable_dma_buffer0(unsigned int dmanr) | ||
161 | { | ||
162 | struct dma_chan *chan = get_dma_chan(dmanr); | ||
163 | if (!chan) | ||
164 | return; | ||
165 | au_writel(DMA_BE0, chan->io + DMA_MODE_SET); | ||
166 | } | ||
167 | static __inline__ void enable_dma_buffer1(unsigned int dmanr) | ||
168 | { | ||
169 | struct dma_chan *chan = get_dma_chan(dmanr); | ||
170 | if (!chan) | ||
171 | return; | ||
172 | au_writel(DMA_BE1, chan->io + DMA_MODE_SET); | ||
173 | } | ||
174 | static __inline__ void enable_dma_buffers(unsigned int dmanr) | ||
175 | { | ||
176 | struct dma_chan *chan = get_dma_chan(dmanr); | ||
177 | if (!chan) | ||
178 | return; | ||
179 | au_writel(DMA_BE0 | DMA_BE1, chan->io + DMA_MODE_SET); | ||
180 | } | ||
181 | |||
182 | static __inline__ void start_dma(unsigned int dmanr) | ||
183 | { | ||
184 | struct dma_chan *chan = get_dma_chan(dmanr); | ||
185 | if (!chan) | ||
186 | return; | ||
187 | |||
188 | au_writel(DMA_GO, chan->io + DMA_MODE_SET); | ||
189 | } | ||
190 | |||
191 | #define DMA_HALT_POLL 0x5000 | ||
192 | |||
193 | static __inline__ void halt_dma(unsigned int dmanr) | ||
194 | { | ||
195 | struct dma_chan *chan = get_dma_chan(dmanr); | ||
196 | int i; | ||
197 | if (!chan) | ||
198 | return; | ||
199 | |||
200 | au_writel(DMA_GO, chan->io + DMA_MODE_CLEAR); | ||
201 | // poll the halt bit | ||
202 | for (i = 0; i < DMA_HALT_POLL; i++) | ||
203 | if (au_readl(chan->io + DMA_MODE_READ) & DMA_HALT) | ||
204 | break; | ||
205 | if (i == DMA_HALT_POLL) | ||
206 | printk(KERN_INFO "halt_dma: HALT poll expired!\n"); | ||
207 | } | ||
208 | |||
209 | |||
210 | static __inline__ void disable_dma(unsigned int dmanr) | ||
211 | { | ||
212 | struct dma_chan *chan = get_dma_chan(dmanr); | ||
213 | if (!chan) | ||
214 | return; | ||
215 | |||
216 | halt_dma(dmanr); | ||
217 | |||
218 | // now we can disable the buffers | ||
219 | au_writel(~DMA_GO, chan->io + DMA_MODE_CLEAR); | ||
220 | } | ||
221 | |||
222 | static __inline__ int dma_halted(unsigned int dmanr) | ||
223 | { | ||
224 | struct dma_chan *chan = get_dma_chan(dmanr); | ||
225 | if (!chan) | ||
226 | return 1; | ||
227 | return (au_readl(chan->io + DMA_MODE_READ) & DMA_HALT) ? 1 : 0; | ||
228 | } | ||
229 | |||
230 | /* initialize a DMA channel */ | ||
231 | static __inline__ void init_dma(unsigned int dmanr) | ||
232 | { | ||
233 | struct dma_chan *chan = get_dma_chan(dmanr); | ||
234 | u32 mode; | ||
235 | if (!chan) | ||
236 | return; | ||
237 | |||
238 | disable_dma(dmanr); | ||
239 | |||
240 | // set device FIFO address | ||
241 | au_writel(CPHYSADDR(chan->fifo_addr), | ||
242 | chan->io + DMA_PERIPHERAL_ADDR); | ||
243 | |||
244 | mode = chan->mode | (chan->dev_id << DMA_DID_BIT); | ||
245 | if (chan->irq) | ||
246 | mode |= DMA_IE; | ||
247 | |||
248 | au_writel(~mode, chan->io + DMA_MODE_CLEAR); | ||
249 | au_writel(mode, chan->io + DMA_MODE_SET); | ||
250 | } | ||
251 | |||
252 | /* | ||
253 | * set mode for a specific DMA channel | ||
254 | */ | ||
255 | static __inline__ void set_dma_mode(unsigned int dmanr, unsigned int mode) | ||
256 | { | ||
257 | struct dma_chan *chan = get_dma_chan(dmanr); | ||
258 | if (!chan) | ||
259 | return; | ||
260 | /* | ||
261 | * set_dma_mode is only allowed to change endianess, direction, | ||
262 | * transfer size, device FIFO width, and coherency settings. | ||
263 | * Make sure anything else is masked off. | ||
264 | */ | ||
265 | mode &= (DMA_BE | DMA_DR | DMA_TS8 | DMA_DW_MASK | DMA_NC); | ||
266 | chan->mode &= ~(DMA_BE | DMA_DR | DMA_TS8 | DMA_DW_MASK | DMA_NC); | ||
267 | chan->mode |= mode; | ||
268 | } | ||
269 | |||
270 | static __inline__ unsigned int get_dma_mode(unsigned int dmanr) | ||
271 | { | ||
272 | struct dma_chan *chan = get_dma_chan(dmanr); | ||
273 | if (!chan) | ||
274 | return 0; | ||
275 | return chan->mode; | ||
276 | } | ||
277 | |||
278 | static __inline__ int get_dma_active_buffer(unsigned int dmanr) | ||
279 | { | ||
280 | struct dma_chan *chan = get_dma_chan(dmanr); | ||
281 | if (!chan) | ||
282 | return -1; | ||
283 | return (au_readl(chan->io + DMA_MODE_READ) & DMA_AB) ? 1 : 0; | ||
284 | } | ||
285 | |||
286 | |||
287 | /* | ||
288 | * set the device FIFO address for a specific DMA channel - only | ||
289 | * applicable to GPO4 and GPO5. All the other devices have fixed | ||
290 | * FIFO addresses. | ||
291 | */ | ||
292 | static __inline__ void set_dma_fifo_addr(unsigned int dmanr, | ||
293 | unsigned int a) | ||
294 | { | ||
295 | struct dma_chan *chan = get_dma_chan(dmanr); | ||
296 | if (!chan) | ||
297 | return; | ||
298 | |||
299 | if (chan->mode & DMA_DS) /* second bank of device ids */ | ||
300 | return; | ||
301 | |||
302 | if (chan->dev_id != DMA_ID_GP04 && chan->dev_id != DMA_ID_GP05) | ||
303 | return; | ||
304 | |||
305 | au_writel(CPHYSADDR(a), chan->io + DMA_PERIPHERAL_ADDR); | ||
306 | } | ||
307 | |||
308 | /* | ||
309 | * Clear the DMA buffer done bits in the mode register. | ||
310 | */ | ||
311 | static __inline__ void clear_dma_done0(unsigned int dmanr) | ||
312 | { | ||
313 | struct dma_chan *chan = get_dma_chan(dmanr); | ||
314 | if (!chan) | ||
315 | return; | ||
316 | au_writel(DMA_D0, chan->io + DMA_MODE_CLEAR); | ||
317 | } | ||
318 | static __inline__ void clear_dma_done1(unsigned int dmanr) | ||
319 | { | ||
320 | struct dma_chan *chan = get_dma_chan(dmanr); | ||
321 | if (!chan) | ||
322 | return; | ||
323 | au_writel(DMA_D1, chan->io + DMA_MODE_CLEAR); | ||
324 | } | ||
325 | |||
326 | /* | ||
327 | * This does nothing - not applicable to Au1000 DMA. | ||
328 | */ | ||
329 | static __inline__ void set_dma_page(unsigned int dmanr, char pagenr) | ||
330 | { | ||
331 | } | ||
332 | |||
333 | /* | ||
334 | * Set Buffer 0 transfer address for specific DMA channel. | ||
335 | */ | ||
336 | static __inline__ void set_dma_addr0(unsigned int dmanr, unsigned int a) | ||
337 | { | ||
338 | struct dma_chan *chan = get_dma_chan(dmanr); | ||
339 | if (!chan) | ||
340 | return; | ||
341 | au_writel(a, chan->io + DMA_BUFFER0_START); | ||
342 | } | ||
343 | |||
344 | /* | ||
345 | * Set Buffer 1 transfer address for specific DMA channel. | ||
346 | */ | ||
347 | static __inline__ void set_dma_addr1(unsigned int dmanr, unsigned int a) | ||
348 | { | ||
349 | struct dma_chan *chan = get_dma_chan(dmanr); | ||
350 | if (!chan) | ||
351 | return; | ||
352 | au_writel(a, chan->io + DMA_BUFFER1_START); | ||
353 | } | ||
354 | |||
355 | |||
356 | /* | ||
357 | * Set Buffer 0 transfer size (max 64k) for a specific DMA channel. | ||
358 | */ | ||
359 | static __inline__ void set_dma_count0(unsigned int dmanr, | ||
360 | unsigned int count) | ||
361 | { | ||
362 | struct dma_chan *chan = get_dma_chan(dmanr); | ||
363 | if (!chan) | ||
364 | return; | ||
365 | count &= DMA_COUNT_MASK; | ||
366 | au_writel(count, chan->io + DMA_BUFFER0_COUNT); | ||
367 | } | ||
368 | |||
369 | /* | ||
370 | * Set Buffer 1 transfer size (max 64k) for a specific DMA channel. | ||
371 | */ | ||
372 | static __inline__ void set_dma_count1(unsigned int dmanr, | ||
373 | unsigned int count) | ||
374 | { | ||
375 | struct dma_chan *chan = get_dma_chan(dmanr); | ||
376 | if (!chan) | ||
377 | return; | ||
378 | count &= DMA_COUNT_MASK; | ||
379 | au_writel(count, chan->io + DMA_BUFFER1_COUNT); | ||
380 | } | ||
381 | |||
382 | /* | ||
383 | * Set both buffer transfer sizes (max 64k) for a specific DMA channel. | ||
384 | */ | ||
385 | static __inline__ void set_dma_count(unsigned int dmanr, | ||
386 | unsigned int count) | ||
387 | { | ||
388 | struct dma_chan *chan = get_dma_chan(dmanr); | ||
389 | if (!chan) | ||
390 | return; | ||
391 | count &= DMA_COUNT_MASK; | ||
392 | au_writel(count, chan->io + DMA_BUFFER0_COUNT); | ||
393 | au_writel(count, chan->io + DMA_BUFFER1_COUNT); | ||
394 | } | ||
395 | |||
396 | /* | ||
397 | * Returns which buffer has its done bit set in the mode register. | ||
398 | * Returns -1 if neither or both done bits set. | ||
399 | */ | ||
400 | static __inline__ unsigned int get_dma_buffer_done(unsigned int dmanr) | ||
401 | { | ||
402 | struct dma_chan *chan = get_dma_chan(dmanr); | ||
403 | if (!chan) | ||
404 | return 0; | ||
405 | |||
406 | return au_readl(chan->io + DMA_MODE_READ) & (DMA_D0 | DMA_D1); | ||
407 | } | ||
408 | |||
409 | |||
410 | /* | ||
411 | * Returns the DMA channel's Buffer Done IRQ number. | ||
412 | */ | ||
413 | static __inline__ int get_dma_done_irq(unsigned int dmanr) | ||
414 | { | ||
415 | struct dma_chan *chan = get_dma_chan(dmanr); | ||
416 | if (!chan) | ||
417 | return -1; | ||
418 | |||
419 | return chan->irq; | ||
420 | } | ||
421 | |||
422 | /* | ||
423 | * Get DMA residue count. Returns the number of _bytes_ left to transfer. | ||
424 | */ | ||
425 | static __inline__ int get_dma_residue(unsigned int dmanr) | ||
426 | { | ||
427 | int curBufCntReg, count; | ||
428 | struct dma_chan *chan = get_dma_chan(dmanr); | ||
429 | if (!chan) | ||
430 | return 0; | ||
431 | |||
432 | curBufCntReg = (au_readl(chan->io + DMA_MODE_READ) & DMA_AB) ? | ||
433 | DMA_BUFFER1_COUNT : DMA_BUFFER0_COUNT; | ||
434 | |||
435 | count = au_readl(chan->io + curBufCntReg) & DMA_COUNT_MASK; | ||
436 | |||
437 | if ((chan->mode & DMA_DW_MASK) == DMA_DW16) | ||
438 | count <<= 1; | ||
439 | else if ((chan->mode & DMA_DW_MASK) == DMA_DW32) | ||
440 | count <<= 2; | ||
441 | |||
442 | return count; | ||
443 | } | ||
444 | |||
445 | #endif /* __ASM_AU1000_DMA_H */ | ||
446 | |||
diff --git a/include/asm-mips/mach-au1x00/au1000_gpio.h b/include/asm-mips/mach-au1x00/au1000_gpio.h new file mode 100644 index 000000000000..298f92012e8e --- /dev/null +++ b/include/asm-mips/mach-au1x00/au1000_gpio.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * FILE NAME au1000_gpio.h | ||
3 | * | ||
4 | * BRIEF MODULE DESCRIPTION | ||
5 | * API to Alchemy Au1000 GPIO device. | ||
6 | * | ||
7 | * Author: MontaVista Software, Inc. <source@mvista.com> | ||
8 | * Steve Longerbeam <stevel@mvista.com> | ||
9 | * | ||
10 | * Copyright 2001 MontaVista Software Inc. | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify it | ||
13 | * under the terms of the GNU General Public License as published by the | ||
14 | * Free Software Foundation; either version 2 of the License, or (at your | ||
15 | * option) any later version. | ||
16 | * | ||
17 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
20 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
23 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
24 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
27 | * | ||
28 | * You should have received a copy of the GNU General Public License along | ||
29 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
30 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
31 | */ | ||
32 | |||
33 | #ifndef __AU1000_GPIO_H | ||
34 | #define __AU1000_GPIO_H | ||
35 | |||
36 | #include <linux/ioctl.h> | ||
37 | |||
38 | #define AU1000GPIO_IOC_MAGIC 'A' | ||
39 | |||
40 | #define AU1000GPIO_IN _IOR (AU1000GPIO_IOC_MAGIC, 0, int) | ||
41 | #define AU1000GPIO_SET _IOW (AU1000GPIO_IOC_MAGIC, 1, int) | ||
42 | #define AU1000GPIO_CLEAR _IOW (AU1000GPIO_IOC_MAGIC, 2, int) | ||
43 | #define AU1000GPIO_OUT _IOW (AU1000GPIO_IOC_MAGIC, 3, int) | ||
44 | #define AU1000GPIO_TRISTATE _IOW (AU1000GPIO_IOC_MAGIC, 4, int) | ||
45 | #define AU1000GPIO_AVAIL_MASK _IOR (AU1000GPIO_IOC_MAGIC, 5, int) | ||
46 | |||
47 | #ifdef __KERNEL__ | ||
48 | extern u32 get_au1000_avail_gpio_mask(void); | ||
49 | extern int au1000gpio_tristate(u32 data); | ||
50 | extern int au1000gpio_in(u32 *data); | ||
51 | extern int au1000gpio_set(u32 data); | ||
52 | extern int au1000gpio_clear(u32 data); | ||
53 | extern int au1000gpio_out(u32 data); | ||
54 | #endif | ||
55 | |||
56 | #endif | ||
diff --git a/include/asm-mips/mach-au1x00/au1000_usbdev.h b/include/asm-mips/mach-au1x00/au1000_usbdev.h new file mode 100644 index 000000000000..05bc74bed0b1 --- /dev/null +++ b/include/asm-mips/mach-au1x00/au1000_usbdev.h | |||
@@ -0,0 +1,73 @@ | |||
1 | /* | ||
2 | * BRIEF MODULE DESCRIPTION | ||
3 | * Au1000 USB Device-Side Driver | ||
4 | * | ||
5 | * Copyright 2001 MontaVista Software Inc. | ||
6 | * Author: MontaVista Software, Inc. | ||
7 | * stevel@mvista.com or source@mvista.com | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the | ||
11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
12 | * option) any later version. | ||
13 | * | ||
14 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
15 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
16 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
17 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
20 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | * | ||
25 | * You should have received a copy of the GNU General Public License along | ||
26 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
27 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
28 | */ | ||
29 | |||
30 | #define USBDEV_REV 0x0110 // BCD | ||
31 | #define USBDEV_EP0_MAX_PACKET_SIZE 64 | ||
32 | |||
33 | typedef enum { | ||
34 | ATTACHED = 0, | ||
35 | POWERED, | ||
36 | DEFAULT, | ||
37 | ADDRESS, | ||
38 | CONFIGURED | ||
39 | } usbdev_state_t; | ||
40 | |||
41 | typedef enum { | ||
42 | CB_NEW_STATE = 0, | ||
43 | CB_PKT_COMPLETE | ||
44 | } usbdev_cb_type_t; | ||
45 | |||
46 | |||
47 | typedef struct usbdev_pkt { | ||
48 | int ep_addr; // ep addr this packet routed to | ||
49 | int size; // size of payload in bytes | ||
50 | unsigned status; // packet status | ||
51 | struct usbdev_pkt* next; // function layer can't touch this | ||
52 | u8 payload[0]; // the payload | ||
53 | } usbdev_pkt_t; | ||
54 | |||
55 | #define PKT_STATUS_ACK (1<<0) | ||
56 | #define PKT_STATUS_NAK (1<<1) | ||
57 | #define PKT_STATUS_SU (1<<2) | ||
58 | |||
59 | extern int usbdev_init(struct usb_device_descriptor* dev_desc, | ||
60 | struct usb_config_descriptor* config_desc, | ||
61 | struct usb_interface_descriptor* if_desc, | ||
62 | struct usb_endpoint_descriptor* ep_desc, | ||
63 | struct usb_string_descriptor* str_desc[], | ||
64 | void (*cb)(usbdev_cb_type_t, unsigned long, void *), | ||
65 | void* cb_data); | ||
66 | |||
67 | extern void usbdev_exit(void); | ||
68 | |||
69 | extern int usbdev_alloc_packet (int ep_addr, int data_size, | ||
70 | usbdev_pkt_t** pkt); | ||
71 | extern int usbdev_send_packet (int ep_addr, usbdev_pkt_t* pkt); | ||
72 | extern int usbdev_receive_packet(int ep_addr, usbdev_pkt_t** pkt); | ||
73 | extern int usbdev_get_byte_count(int ep_addr); | ||
diff --git a/include/asm-mips/mach-au1x00/au1100_mmc.h b/include/asm-mips/mach-au1x00/au1100_mmc.h new file mode 100644 index 000000000000..9e7d1ba21b55 --- /dev/null +++ b/include/asm-mips/mach-au1x00/au1100_mmc.h | |||
@@ -0,0 +1,205 @@ | |||
1 | /* | ||
2 | * BRIEF MODULE DESCRIPTION | ||
3 | * Defines for using the MMC/SD controllers on the | ||
4 | * Alchemy Au1100 mips processor. | ||
5 | * | ||
6 | * Copyright (c) 2003 Embedded Edge, LLC. | ||
7 | * Author: Embedded Edge, LLC. | ||
8 | * dan@embeddededge.com or tim@embeddededge.com | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License as published by the | ||
12 | * Free Software Foundation; either version 2 of the License, or (at your | ||
13 | * option) any later version. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
16 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
17 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
18 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
21 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
22 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | * You should have received a copy of the GNU General Public License along | ||
27 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
28 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
29 | * | ||
30 | */ | ||
31 | /* | ||
32 | * AU1100 MMC/SD definitions. | ||
33 | * | ||
34 | * From "AMD Alchemy Solutions Au1100 Processor Data Book - Preliminary" | ||
35 | * June, 2003 | ||
36 | */ | ||
37 | |||
38 | #ifndef __ASM_AU1100_MMC_H | ||
39 | #define __ASM_AU1100_MMC_H | ||
40 | |||
41 | |||
42 | #define NUM_AU1100_MMC_CONTROLLERS 2 | ||
43 | |||
44 | |||
45 | #define AU1100_SD_IRQ 2 | ||
46 | |||
47 | |||
48 | #define SD0_BASE 0xB0600000 | ||
49 | #define SD1_BASE 0xB0680000 | ||
50 | |||
51 | |||
52 | /* | ||
53 | * Register offsets. | ||
54 | */ | ||
55 | #define SD_TXPORT (0x0000) | ||
56 | #define SD_RXPORT (0x0004) | ||
57 | #define SD_CONFIG (0x0008) | ||
58 | #define SD_ENABLE (0x000C) | ||
59 | #define SD_CONFIG2 (0x0010) | ||
60 | #define SD_BLKSIZE (0x0014) | ||
61 | #define SD_STATUS (0x0018) | ||
62 | #define SD_DEBUG (0x001C) | ||
63 | #define SD_CMD (0x0020) | ||
64 | #define SD_CMDARG (0x0024) | ||
65 | #define SD_RESP3 (0x0028) | ||
66 | #define SD_RESP2 (0x002C) | ||
67 | #define SD_RESP1 (0x0030) | ||
68 | #define SD_RESP0 (0x0034) | ||
69 | #define SD_TIMEOUT (0x0038) | ||
70 | |||
71 | |||
72 | /* | ||
73 | * SD_TXPORT bit definitions. | ||
74 | */ | ||
75 | #define SD_TXPORT_TXD (0x000000ff) | ||
76 | |||
77 | |||
78 | /* | ||
79 | * SD_RXPORT bit definitions. | ||
80 | */ | ||
81 | #define SD_RXPORT_RXD (0x000000ff) | ||
82 | |||
83 | |||
84 | /* | ||
85 | * SD_CONFIG bit definitions. | ||
86 | */ | ||
87 | #define SD_CONFIG_DIV (0x000001ff) | ||
88 | #define SD_CONFIG_DE (0x00000200) | ||
89 | #define SD_CONFIG_NE (0x00000400) | ||
90 | #define SD_CONFIG_TU (0x00000800) | ||
91 | #define SD_CONFIG_TO (0x00001000) | ||
92 | #define SD_CONFIG_RU (0x00002000) | ||
93 | #define SD_CONFIG_RO (0x00004000) | ||
94 | #define SD_CONFIG_I (0x00008000) | ||
95 | #define SD_CONFIG_CR (0x00010000) | ||
96 | #define SD_CONFIG_RAT (0x00020000) | ||
97 | #define SD_CONFIG_DD (0x00040000) | ||
98 | #define SD_CONFIG_DT (0x00080000) | ||
99 | #define SD_CONFIG_SC (0x00100000) | ||
100 | #define SD_CONFIG_RC (0x00200000) | ||
101 | #define SD_CONFIG_WC (0x00400000) | ||
102 | #define SD_CONFIG_xxx (0x00800000) | ||
103 | #define SD_CONFIG_TH (0x01000000) | ||
104 | #define SD_CONFIG_TE (0x02000000) | ||
105 | #define SD_CONFIG_TA (0x04000000) | ||
106 | #define SD_CONFIG_RH (0x08000000) | ||
107 | #define SD_CONFIG_RA (0x10000000) | ||
108 | #define SD_CONFIG_RF (0x20000000) | ||
109 | #define SD_CONFIG_CD (0x40000000) | ||
110 | #define SD_CONFIG_SI (0x80000000) | ||
111 | |||
112 | |||
113 | /* | ||
114 | * SD_ENABLE bit definitions. | ||
115 | */ | ||
116 | #define SD_ENABLE_CE (0x00000001) | ||
117 | #define SD_ENABLE_R (0x00000002) | ||
118 | |||
119 | |||
120 | /* | ||
121 | * SD_CONFIG2 bit definitions. | ||
122 | */ | ||
123 | #define SD_CONFIG2_EN (0x00000001) | ||
124 | #define SD_CONFIG2_FF (0x00000002) | ||
125 | #define SD_CONFIG2_xx1 (0x00000004) | ||
126 | #define SD_CONFIG2_DF (0x00000008) | ||
127 | #define SD_CONFIG2_DC (0x00000010) | ||
128 | #define SD_CONFIG2_xx2 (0x000000e0) | ||
129 | #define SD_CONFIG2_WB (0x00000100) | ||
130 | #define SD_CONFIG2_RW (0x00000200) | ||
131 | |||
132 | |||
133 | /* | ||
134 | * SD_BLKSIZE bit definitions. | ||
135 | */ | ||
136 | #define SD_BLKSIZE_BS (0x000007ff) | ||
137 | #define SD_BLKSIZE_BS_SHIFT (0) | ||
138 | #define SD_BLKSIZE_BC (0x01ff0000) | ||
139 | #define SD_BLKSIZE_BC_SHIFT (16) | ||
140 | |||
141 | |||
142 | /* | ||
143 | * SD_STATUS bit definitions. | ||
144 | */ | ||
145 | #define SD_STATUS_DCRCW (0x00000007) | ||
146 | #define SD_STATUS_xx1 (0x00000008) | ||
147 | #define SD_STATUS_CB (0x00000010) | ||
148 | #define SD_STATUS_DB (0x00000020) | ||
149 | #define SD_STATUS_CF (0x00000040) | ||
150 | #define SD_STATUS_D3 (0x00000080) | ||
151 | #define SD_STATUS_xx2 (0x00000300) | ||
152 | #define SD_STATUS_NE (0x00000400) | ||
153 | #define SD_STATUS_TU (0x00000800) | ||
154 | #define SD_STATUS_TO (0x00001000) | ||
155 | #define SD_STATUS_RU (0x00002000) | ||
156 | #define SD_STATUS_RO (0x00004000) | ||
157 | #define SD_STATUS_I (0x00008000) | ||
158 | #define SD_STATUS_CR (0x00010000) | ||
159 | #define SD_STATUS_RAT (0x00020000) | ||
160 | #define SD_STATUS_DD (0x00040000) | ||
161 | #define SD_STATUS_DT (0x00080000) | ||
162 | #define SD_STATUS_SC (0x00100000) | ||
163 | #define SD_STATUS_RC (0x00200000) | ||
164 | #define SD_STATUS_WC (0x00400000) | ||
165 | #define SD_STATUS_xx3 (0x00800000) | ||
166 | #define SD_STATUS_TH (0x01000000) | ||
167 | #define SD_STATUS_TE (0x02000000) | ||
168 | #define SD_STATUS_TA (0x04000000) | ||
169 | #define SD_STATUS_RH (0x08000000) | ||
170 | #define SD_STATUS_RA (0x10000000) | ||
171 | #define SD_STATUS_RF (0x20000000) | ||
172 | #define SD_STATUS_CD (0x40000000) | ||
173 | #define SD_STATUS_SI (0x80000000) | ||
174 | |||
175 | |||
176 | /* | ||
177 | * SD_CMD bit definitions. | ||
178 | */ | ||
179 | #define SD_CMD_GO (0x00000001) | ||
180 | #define SD_CMD_RY (0x00000002) | ||
181 | #define SD_CMD_xx1 (0x0000000c) | ||
182 | #define SD_CMD_CT_MASK (0x000000f0) | ||
183 | #define SD_CMD_CT_0 (0x00000000) | ||
184 | #define SD_CMD_CT_1 (0x00000010) | ||
185 | #define SD_CMD_CT_2 (0x00000020) | ||
186 | #define SD_CMD_CT_3 (0x00000030) | ||
187 | #define SD_CMD_CT_4 (0x00000040) | ||
188 | #define SD_CMD_CT_5 (0x00000050) | ||
189 | #define SD_CMD_CT_6 (0x00000060) | ||
190 | #define SD_CMD_CT_7 (0x00000070) | ||
191 | #define SD_CMD_CI (0x0000ff00) | ||
192 | #define SD_CMD_CI_SHIFT (8) | ||
193 | #define SD_CMD_RT_MASK (0x00ff0000) | ||
194 | #define SD_CMD_RT_0 (0x00000000) | ||
195 | #define SD_CMD_RT_1 (0x00010000) | ||
196 | #define SD_CMD_RT_2 (0x00020000) | ||
197 | #define SD_CMD_RT_3 (0x00030000) | ||
198 | #define SD_CMD_RT_4 (0x00040000) | ||
199 | #define SD_CMD_RT_5 (0x00050000) | ||
200 | #define SD_CMD_RT_6 (0x00060000) | ||
201 | #define SD_CMD_RT_1B (0x00810000) | ||
202 | |||
203 | |||
204 | #endif /* __ASM_AU1100_MMC_H */ | ||
205 | |||
diff --git a/include/asm-mips/mach-au1x00/au1xxx_dbdma.h b/include/asm-mips/mach-au1x00/au1xxx_dbdma.h new file mode 100644 index 000000000000..d5eb88cd7d51 --- /dev/null +++ b/include/asm-mips/mach-au1x00/au1xxx_dbdma.h | |||
@@ -0,0 +1,299 @@ | |||
1 | /* | ||
2 | * | ||
3 | * BRIEF MODULE DESCRIPTION | ||
4 | * Include file for Alchemy Semiconductor's Au1550 Descriptor | ||
5 | * Based DMA Controller. | ||
6 | * | ||
7 | * Copyright 2004 Embedded Edge, LLC | ||
8 | * dan@embeddededge.com | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License as published by the | ||
12 | * Free Software Foundation; either version 2 of the License, or (at your | ||
13 | * option) any later version. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
16 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
17 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
18 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
21 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
22 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | * You should have received a copy of the GNU General Public License along | ||
27 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
28 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
29 | */ | ||
30 | |||
31 | /* Specifics for the Au1xxx Descriptor-Based DMA Controllers, first | ||
32 | * seen in the AU1550 part. | ||
33 | */ | ||
34 | #ifndef _AU1000_DBDMA_H_ | ||
35 | #define _AU1000_DBDMA_H_ | ||
36 | |||
37 | #include <linux/config.h> | ||
38 | |||
39 | #ifndef _LANGUAGE_ASSEMBLY | ||
40 | |||
41 | /* The DMA base addresses. | ||
42 | * The Channels are every 256 bytes (0x0100) from the channel 0 base. | ||
43 | * Interrupt status/enable is bits 15:0 for channels 15 to zero. | ||
44 | */ | ||
45 | #define DDMA_GLOBAL_BASE 0xb4003000 | ||
46 | #define DDMA_CHANNEL_BASE 0xb4002000 | ||
47 | |||
48 | typedef struct dbdma_global { | ||
49 | u32 ddma_config; | ||
50 | u32 ddma_intstat; | ||
51 | u32 ddma_throttle; | ||
52 | u32 ddma_inten; | ||
53 | } dbdma_global_t; | ||
54 | |||
55 | /* General Configuration. | ||
56 | */ | ||
57 | #define DDMA_CONFIG_AF (1 << 2) | ||
58 | #define DDMA_CONFIG_AH (1 << 1) | ||
59 | #define DDMA_CONFIG_AL (1 << 0) | ||
60 | |||
61 | #define DDMA_THROTTLE_EN (1 << 31) | ||
62 | |||
63 | /* The structure of a DMA Channel. | ||
64 | */ | ||
65 | typedef struct au1xxx_dma_channel { | ||
66 | u32 ddma_cfg; /* See below */ | ||
67 | u32 ddma_desptr; /* 32-byte aligned pointer to descriptor */ | ||
68 | u32 ddma_statptr; /* word aligned pointer to status word */ | ||
69 | u32 ddma_dbell; /* A write activates channel operation */ | ||
70 | u32 ddma_irq; /* If bit 0 set, interrupt pending */ | ||
71 | u32 ddma_stat; /* See below */ | ||
72 | u32 ddma_bytecnt; /* Byte count, valid only when chan idle */ | ||
73 | /* Remainder, up to the 256 byte boundary, is reserved. | ||
74 | */ | ||
75 | } au1x_dma_chan_t; | ||
76 | |||
77 | #define DDMA_CFG_SED (1 << 9) /* source DMA level/edge detect */ | ||
78 | #define DDMA_CFG_SP (1 << 8) /* source DMA polarity */ | ||
79 | #define DDMA_CFG_DED (1 << 7) /* destination DMA level/edge detect */ | ||
80 | #define DDMA_CFG_DP (1 << 6) /* destination DMA polarity */ | ||
81 | #define DDMA_CFG_SYNC (1 << 5) /* Sync static bus controller */ | ||
82 | #define DDMA_CFG_PPR (1 << 4) /* PCI posted read/write control */ | ||
83 | #define DDMA_CFG_DFN (1 << 3) /* Descriptor fetch non-coherent */ | ||
84 | #define DDMA_CFG_SBE (1 << 2) /* Source big endian */ | ||
85 | #define DDMA_CFG_DBE (1 << 1) /* Destination big endian */ | ||
86 | #define DDMA_CFG_EN (1 << 0) /* Channel enable */ | ||
87 | |||
88 | /* Always set when descriptor processing done, regardless of | ||
89 | * interrupt enable state. Reflected in global intstat, don't | ||
90 | * clear this until global intstat is read/used. | ||
91 | */ | ||
92 | #define DDMA_IRQ_IN (1 << 0) | ||
93 | |||
94 | #define DDMA_STAT_DB (1 << 2) /* Doorbell pushed */ | ||
95 | #define DDMA_STAT_V (1 << 1) /* Descriptor valid */ | ||
96 | #define DDMA_STAT_H (1 << 0) /* Channel Halted */ | ||
97 | |||
98 | /* "Standard" DDMA Descriptor. | ||
99 | * Must be 32-byte aligned. | ||
100 | */ | ||
101 | typedef struct au1xxx_ddma_desc { | ||
102 | u32 dscr_cmd0; /* See below */ | ||
103 | u32 dscr_cmd1; /* See below */ | ||
104 | u32 dscr_source0; /* source phys address */ | ||
105 | u32 dscr_source1; /* See below */ | ||
106 | u32 dscr_dest0; /* Destination address */ | ||
107 | u32 dscr_dest1; /* See below */ | ||
108 | u32 dscr_stat; /* completion status */ | ||
109 | u32 dscr_nxtptr; /* Next descriptor pointer (mostly) */ | ||
110 | } au1x_ddma_desc_t; | ||
111 | |||
112 | #define DSCR_CMD0_V (1 << 31) /* Descriptor valid */ | ||
113 | #define DSCR_CMD0_MEM (1 << 30) /* mem-mem transfer */ | ||
114 | #define DSCR_CMD0_SID_MASK (0x1f << 25) /* Source ID */ | ||
115 | #define DSCR_CMD0_DID_MASK (0x1f << 20) /* Destination ID */ | ||
116 | #define DSCR_CMD0_SW_MASK (0x3 << 18) /* Source Width */ | ||
117 | #define DSCR_CMD0_DW_MASK (0x3 << 16) /* Destination Width */ | ||
118 | #define DSCR_CMD0_ARB (0x1 << 15) /* Set for Hi Pri */ | ||
119 | #define DSCR_CMD0_DT_MASK (0x3 << 13) /* Descriptor Type */ | ||
120 | #define DSCR_CMD0_SN (0x1 << 12) /* Source non-coherent */ | ||
121 | #define DSCR_CMD0_DN (0x1 << 11) /* Destination non-coherent */ | ||
122 | #define DSCR_CMD0_SM (0x1 << 10) /* Stride mode */ | ||
123 | #define DSCR_CMD0_IE (0x1 << 8) /* Interrupt Enable */ | ||
124 | #define DSCR_CMD0_SP (0x1 << 4) /* Status pointer select */ | ||
125 | #define DSCR_CMD0_CV (0x1 << 2) /* Clear Valid when done */ | ||
126 | #define DSCR_CMD0_ST_MASK (0x3 << 0) /* Status instruction */ | ||
127 | |||
128 | /* Command 0 device IDs. | ||
129 | */ | ||
130 | #define DSCR_CMD0_UART0_TX 0 | ||
131 | #define DSCR_CMD0_UART0_RX 1 | ||
132 | #define DSCR_CMD0_UART3_TX 2 | ||
133 | #define DSCR_CMD0_UART3_RX 3 | ||
134 | #define DSCR_CMD0_DMA_REQ0 4 | ||
135 | #define DSCR_CMD0_DMA_REQ1 5 | ||
136 | #define DSCR_CMD0_DMA_REQ2 6 | ||
137 | #define DSCR_CMD0_DMA_REQ3 7 | ||
138 | #define DSCR_CMD0_USBDEV_RX0 8 | ||
139 | #define DSCR_CMD0_USBDEV_TX0 9 | ||
140 | #define DSCR_CMD0_USBDEV_TX1 10 | ||
141 | #define DSCR_CMD0_USBDEV_TX2 11 | ||
142 | #define DSCR_CMD0_USBDEV_RX3 12 | ||
143 | #define DSCR_CMD0_USBDEV_RX4 13 | ||
144 | #define DSCR_CMD0_PSC0_TX 14 | ||
145 | #define DSCR_CMD0_PSC0_RX 15 | ||
146 | #define DSCR_CMD0_PSC1_TX 16 | ||
147 | #define DSCR_CMD0_PSC1_RX 17 | ||
148 | #define DSCR_CMD0_PSC2_TX 18 | ||
149 | #define DSCR_CMD0_PSC2_RX 19 | ||
150 | #define DSCR_CMD0_PSC3_TX 20 | ||
151 | #define DSCR_CMD0_PSC3_RX 21 | ||
152 | #define DSCR_CMD0_PCI_WRITE 22 | ||
153 | #define DSCR_CMD0_NAND_FLASH 23 | ||
154 | #define DSCR_CMD0_MAC0_RX 24 | ||
155 | #define DSCR_CMD0_MAC0_TX 25 | ||
156 | #define DSCR_CMD0_MAC1_RX 26 | ||
157 | #define DSCR_CMD0_MAC1_TX 27 | ||
158 | #define DSCR_CMD0_THROTTLE 30 | ||
159 | #define DSCR_CMD0_ALWAYS 31 | ||
160 | #define DSCR_NDEV_IDS 32 | ||
161 | |||
162 | #define DSCR_CMD0_SID(x) (((x) & 0x1f) << 25) | ||
163 | #define DSCR_CMD0_DID(x) (((x) & 0x1f) << 20) | ||
164 | |||
165 | /* Source/Destination transfer width. | ||
166 | */ | ||
167 | #define DSCR_CMD0_BYTE 0 | ||
168 | #define DSCR_CMD0_HALFWORD 1 | ||
169 | #define DSCR_CMD0_WORD 2 | ||
170 | |||
171 | #define DSCR_CMD0_SW(x) (((x) & 0x3) << 18) | ||
172 | #define DSCR_CMD0_DW(x) (((x) & 0x3) << 16) | ||
173 | |||
174 | /* DDMA Descriptor Type. | ||
175 | */ | ||
176 | #define DSCR_CMD0_STANDARD 0 | ||
177 | #define DSCR_CMD0_LITERAL 1 | ||
178 | #define DSCR_CMD0_CMP_BRANCH 2 | ||
179 | |||
180 | #define DSCR_CMD0_DT(x) (((x) & 0x3) << 13) | ||
181 | |||
182 | /* Status Instruction. | ||
183 | */ | ||
184 | #define DSCR_CMD0_ST_NOCHANGE 0 /* Don't change */ | ||
185 | #define DSCR_CMD0_ST_CURRENT 1 /* Write current status */ | ||
186 | #define DSCR_CMD0_ST_CMD0 2 /* Write cmd0 with V cleared */ | ||
187 | #define DSCR_CMD0_ST_BYTECNT 3 /* Write remaining byte count */ | ||
188 | |||
189 | #define DSCR_CMD0_ST(x) (((x) & 0x3) << 0) | ||
190 | |||
191 | /* Descriptor Command 1 | ||
192 | */ | ||
193 | #define DSCR_CMD1_SUPTR_MASK (0xf << 28) /* upper 4 bits of src addr */ | ||
194 | #define DSCR_CMD1_DUPTR_MASK (0xf << 24) /* upper 4 bits of dest addr */ | ||
195 | #define DSCR_CMD1_FL_MASK (0x3 << 22) /* Flag bits */ | ||
196 | #define DSCR_CMD1_BC_MASK (0x3fffff) /* Byte count */ | ||
197 | |||
198 | /* Flag description. | ||
199 | */ | ||
200 | #define DSCR_CMD1_FL_MEM_STRIDE0 0 | ||
201 | #define DSCR_CMD1_FL_MEM_STRIDE1 1 | ||
202 | #define DSCR_CMD1_FL_MEM_STRIDE2 2 | ||
203 | |||
204 | #define DSCR_CMD1_FL(x) (((x) & 0x3) << 22) | ||
205 | |||
206 | /* Source1, 1-dimensional stride. | ||
207 | */ | ||
208 | #define DSCR_SRC1_STS_MASK (3 << 30) /* Src xfer size */ | ||
209 | #define DSCR_SRC1_SAM_MASK (3 << 28) /* Src xfer movement */ | ||
210 | #define DSCR_SRC1_SB_MASK (0x3fff << 14) /* Block size */ | ||
211 | #define DSCR_SRC1_SB(x) (((x) & 0x3fff) << 14) | ||
212 | #define DSCR_SRC1_SS_MASK (0x3fff << 0) /* Stride */ | ||
213 | #define DSCR_SRC1_SS(x) (((x) & 0x3fff) << 0) | ||
214 | |||
215 | /* Dest1, 1-dimensional stride. | ||
216 | */ | ||
217 | #define DSCR_DEST1_DTS_MASK (3 << 30) /* Dest xfer size */ | ||
218 | #define DSCR_DEST1_DAM_MASK (3 << 28) /* Dest xfer movement */ | ||
219 | #define DSCR_DEST1_DB_MASK (0x3fff << 14) /* Block size */ | ||
220 | #define DSCR_DEST1_DB(x) (((x) & 0x3fff) << 14) | ||
221 | #define DSCR_DEST1_DS_MASK (0x3fff << 0) /* Stride */ | ||
222 | #define DSCR_DEST1_DS(x) (((x) & 0x3fff) << 0) | ||
223 | |||
224 | #define DSCR_xTS_SIZE1 0 | ||
225 | #define DSCR_xTS_SIZE2 1 | ||
226 | #define DSCR_xTS_SIZE4 2 | ||
227 | #define DSCR_xTS_SIZE8 3 | ||
228 | #define DSCR_SRC1_STS(x) (((x) & 3) << 30) | ||
229 | #define DSCR_DEST1_DTS(x) (((x) & 3) << 30) | ||
230 | |||
231 | #define DSCR_xAM_INCREMENT 0 | ||
232 | #define DSCR_xAM_DECREMENT 1 | ||
233 | #define DSCR_xAM_STATIC 2 | ||
234 | #define DSCR_xAM_BURST 3 | ||
235 | #define DSCR_SRC1_SAM(x) (((x) & 3) << 28) | ||
236 | #define DSCR_DEST1_DAM(x) (((x) & 3) << 28) | ||
237 | |||
238 | /* The next descriptor pointer. | ||
239 | */ | ||
240 | #define DSCR_NXTPTR_MASK (0x07ffffff) | ||
241 | #define DSCR_NXTPTR(x) ((x) >> 5) | ||
242 | #define DSCR_GET_NXTPTR(x) ((x) << 5) | ||
243 | #define DSCR_NXTPTR_MS (1 << 27) | ||
244 | |||
245 | /* The number of DBDMA channels. | ||
246 | */ | ||
247 | #define NUM_DBDMA_CHANS 16 | ||
248 | |||
249 | /* External functions for drivers to use. | ||
250 | */ | ||
251 | /* Use this to allocate a dbdma channel. The device ids are one of the | ||
252 | * DSCR_CMD0 devices IDs, which is usually redefined to a more | ||
253 | * meaningful name. The 'callback' is called during dma completion | ||
254 | * interrupt. | ||
255 | */ | ||
256 | u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid, | ||
257 | void (*callback)(int, void *, struct pt_regs *), void *callparam); | ||
258 | |||
259 | #define DBDMA_MEM_CHAN DSCR_CMD0_ALWAYS | ||
260 | |||
261 | /* ACK! These should be in a board specific description file. | ||
262 | */ | ||
263 | #ifdef CONFIG_MIPS_PB1550 | ||
264 | #define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX | ||
265 | #define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX | ||
266 | #endif | ||
267 | #ifdef CONFIG_MIPS_DB1550 | ||
268 | #define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX | ||
269 | #define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX | ||
270 | #endif | ||
271 | |||
272 | |||
273 | /* Set the device width of a in/out fifo. | ||
274 | */ | ||
275 | u32 au1xxx_dbdma_set_devwidth(u32 chanid, int bits); | ||
276 | |||
277 | /* Allocate a ring of descriptors for dbdma. | ||
278 | */ | ||
279 | u32 au1xxx_dbdma_ring_alloc(u32 chanid, int entries); | ||
280 | |||
281 | /* Put buffers on source/destination descriptors. | ||
282 | */ | ||
283 | u32 au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes); | ||
284 | u32 au1xxx_dbdma_put_dest(u32 chanid, void *buf, int nbytes); | ||
285 | |||
286 | /* Get a buffer from the destination descriptor. | ||
287 | */ | ||
288 | u32 au1xxx_dbdma_get_dest(u32 chanid, void **buf, int *nbytes); | ||
289 | |||
290 | void au1xxx_dbdma_stop(u32 chanid); | ||
291 | void au1xxx_dbdma_start(u32 chanid); | ||
292 | void au1xxx_dbdma_reset(u32 chanid); | ||
293 | u32 au1xxx_get_dma_residue(u32 chanid); | ||
294 | |||
295 | void au1xxx_dbdma_chan_free(u32 chanid); | ||
296 | void au1xxx_dbdma_dump(u32 chanid); | ||
297 | |||
298 | #endif /* _LANGUAGE_ASSEMBLY */ | ||
299 | #endif /* _AU1000_DBDMA_H_ */ | ||
diff --git a/include/asm-mips/mach-au1x00/au1xxx_psc.h b/include/asm-mips/mach-au1x00/au1xxx_psc.h new file mode 100644 index 000000000000..283519dfdec4 --- /dev/null +++ b/include/asm-mips/mach-au1x00/au1xxx_psc.h | |||
@@ -0,0 +1,522 @@ | |||
1 | /* | ||
2 | * | ||
3 | * BRIEF MODULE DESCRIPTION | ||
4 | * Include file for Alchemy Semiconductor's Au1k CPU. | ||
5 | * | ||
6 | * Copyright 2004 Embedded Edge, LLC | ||
7 | * dan@embeddededge.com | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the | ||
11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
12 | * option) any later version. | ||
13 | * | ||
14 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
15 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
16 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
17 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
20 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | * | ||
25 | * You should have received a copy of the GNU General Public License along | ||
26 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
27 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
28 | */ | ||
29 | |||
30 | /* Specifics for the Au1xxx Programmable Serial Controllers, first | ||
31 | * seen in the AU1550 part. | ||
32 | */ | ||
33 | #ifndef _AU1000_PSC_H_ | ||
34 | #define _AU1000_PSC_H_ | ||
35 | |||
36 | /* The PSC base addresses. */ | ||
37 | #ifdef CONFIG_SOC_AU1550 | ||
38 | #define PSC0_BASE_ADDR 0xb1a00000 | ||
39 | #define PSC1_BASE_ADDR 0xb1b00000 | ||
40 | #define PSC2_BASE_ADDR 0xb0a00000 | ||
41 | #define PSC3_BASE_ADDR 0xb0d00000 | ||
42 | #endif | ||
43 | |||
44 | /* The PSC select and control registers are common to | ||
45 | * all protocols. | ||
46 | */ | ||
47 | #define PSC_SEL_OFFSET 0x00000000 | ||
48 | #define PSC_CTRL_OFFSET 0x00000004 | ||
49 | |||
50 | #define PSC_SEL_CLK_MASK (3 << 4) | ||
51 | #define PSC_SEL_CLK_INTCLK (0 << 4) | ||
52 | #define PSC_SEL_CLK_EXTCLK (1 << 4) | ||
53 | #define PSC_SEL_CLK_SERCLK (2 << 4) | ||
54 | |||
55 | #define PSC_SEL_PS_MASK 0x00000007 | ||
56 | #define PSC_SEL_PS_DISABLED (0) | ||
57 | #define PSC_SEL_PS_SPIMODE (2) | ||
58 | #define PSC_SEL_PS_I2SMODE (3) | ||
59 | #define PSC_SEL_PS_AC97MODE (4) | ||
60 | #define PSC_SEL_PS_SMBUSMODE (5) | ||
61 | |||
62 | #define PSC_CTRL_DISABLE (0) | ||
63 | #define PSC_CTRL_SUSPEND (2) | ||
64 | #define PSC_CTRL_ENABLE (3) | ||
65 | |||
66 | /* AC97 Registers. | ||
67 | */ | ||
68 | #define PSC_AC97CFG_OFFSET 0x00000008 | ||
69 | #define PSC_AC97MSK_OFFSET 0x0000000c | ||
70 | #define PSC_AC97PCR_OFFSET 0x00000010 | ||
71 | #define PSC_AC97STAT_OFFSET 0x00000014 | ||
72 | #define PSC_AC97EVNT_OFFSET 0x00000018 | ||
73 | #define PSC_AC97TXRX_OFFSET 0x0000001c | ||
74 | #define PSC_AC97CDC_OFFSET 0x00000020 | ||
75 | #define PSC_AC97RST_OFFSET 0x00000024 | ||
76 | #define PSC_AC97GPO_OFFSET 0x00000028 | ||
77 | #define PSC_AC97GPI_OFFSET 0x0000002c | ||
78 | |||
79 | #define AC97_PSC_SEL (AC97_PSC_BASE + PSC_SEL_OFFSET) | ||
80 | #define AC97_PSC_CTRL (AC97_PSC_BASE + PSC_CTRL_OFFSET) | ||
81 | #define PSC_AC97CFG (AC97_PSC_BASE + PSC_AC97CFG_OFFSET) | ||
82 | #define PSC_AC97MSK (AC97_PSC_BASE + PSC_AC97MSK_OFFSET) | ||
83 | #define PSC_AC97PCR (AC97_PSC_BASE + PSC_AC97PCR_OFFSET) | ||
84 | #define PSC_AC97STAT (AC97_PSC_BASE + PSC_AC97STAT_OFFSET) | ||
85 | #define PSC_AC97EVNT (AC97_PSC_BASE + PSC_AC97EVNT_OFFSET) | ||
86 | #define PSC_AC97TXRX (AC97_PSC_BASE + PSC_AC97TXRX_OFFSET) | ||
87 | #define PSC_AC97CDC (AC97_PSC_BASE + PSC_AC97CDC_OFFSET) | ||
88 | #define PSC_AC97RST (AC97_PSC_BASE + PSC_AC97RST_OFFSET) | ||
89 | #define PSC_AC97GPO (AC97_PSC_BASE + PSC_AC97GPO_OFFSET) | ||
90 | #define PSC_AC97GPI (AC97_PSC_BASE + PSC_AC97GPI_OFFSET) | ||
91 | |||
92 | /* AC97 Config Register. | ||
93 | */ | ||
94 | #define PSC_AC97CFG_RT_MASK (3 << 30) | ||
95 | #define PSC_AC97CFG_RT_FIFO1 (0 << 30) | ||
96 | #define PSC_AC97CFG_RT_FIFO2 (1 << 30) | ||
97 | #define PSC_AC97CFG_RT_FIFO4 (2 << 30) | ||
98 | #define PSC_AC97CFG_RT_FIFO8 (3 << 30) | ||
99 | |||
100 | #define PSC_AC97CFG_TT_MASK (3 << 28) | ||
101 | #define PSC_AC97CFG_TT_FIFO1 (0 << 28) | ||
102 | #define PSC_AC97CFG_TT_FIFO2 (1 << 28) | ||
103 | #define PSC_AC97CFG_TT_FIFO4 (2 << 28) | ||
104 | #define PSC_AC97CFG_TT_FIFO8 (3 << 28) | ||
105 | |||
106 | #define PSC_AC97CFG_DD_DISABLE (1 << 27) | ||
107 | #define PSC_AC97CFG_DE_ENABLE (1 << 26) | ||
108 | #define PSC_AC97CFG_SE_ENABLE (1 << 25) | ||
109 | |||
110 | #define PSC_AC97CFG_LEN_MASK (0xf << 21) | ||
111 | #define PSC_AC97CFG_TXSLOT_MASK (0x3ff << 11) | ||
112 | #define PSC_AC97CFG_RXSLOT_MASK (0x3ff << 1) | ||
113 | #define PSC_AC97CFG_GE_ENABLE (1) | ||
114 | |||
115 | /* Enable slots 3-12. | ||
116 | */ | ||
117 | #define PSC_AC97CFG_TXSLOT_ENA(x) (1 << (((x) - 3) + 11)) | ||
118 | #define PSC_AC97CFG_RXSLOT_ENA(x) (1 << (((x) - 3) + 1)) | ||
119 | |||
120 | /* The word length equation is ((x) * 2) + 2, so choose 'x' appropriately. | ||
121 | * The only sensible numbers are 7, 9, or possibly 11. Nah, just do the | ||
122 | * arithmetic in the macro. | ||
123 | */ | ||
124 | #define PSC_AC97CFG_SET_LEN(x) (((((x)-2)/2) & 0xf) << 21) | ||
125 | #define PSC_AC97CFG_GET_LEN(x) (((((x) >> 21) & 0xf) * 2) + 2) | ||
126 | |||
127 | /* AC97 Mask Register. | ||
128 | */ | ||
129 | #define PSC_AC97MSK_GR (1 << 25) | ||
130 | #define PSC_AC97MSK_CD (1 << 24) | ||
131 | #define PSC_AC97MSK_RR (1 << 13) | ||
132 | #define PSC_AC97MSK_RO (1 << 12) | ||
133 | #define PSC_AC97MSK_RU (1 << 11) | ||
134 | #define PSC_AC97MSK_TR (1 << 10) | ||
135 | #define PSC_AC97MSK_TO (1 << 9) | ||
136 | #define PSC_AC97MSK_TU (1 << 8) | ||
137 | #define PSC_AC97MSK_RD (1 << 5) | ||
138 | #define PSC_AC97MSK_TD (1 << 4) | ||
139 | #define PSC_AC97MSK_ALLMASK (PSC_AC97MSK_GR | PSC_AC97MSK_CD | \ | ||
140 | PSC_AC97MSK_RR | PSC_AC97MSK_RO | \ | ||
141 | PSC_AC97MSK_RU | PSC_AC97MSK_TR | \ | ||
142 | PSC_AC97MSK_TO | PSC_AC97MSK_TU | \ | ||
143 | PSC_AC97MSK_RD | PSC_AC97MSK_TD) | ||
144 | |||
145 | /* AC97 Protocol Control Register. | ||
146 | */ | ||
147 | #define PSC_AC97PCR_RC (1 << 6) | ||
148 | #define PSC_AC97PCR_RP (1 << 5) | ||
149 | #define PSC_AC97PCR_RS (1 << 4) | ||
150 | #define PSC_AC97PCR_TC (1 << 2) | ||
151 | #define PSC_AC97PCR_TP (1 << 1) | ||
152 | #define PSC_AC97PCR_TS (1 << 0) | ||
153 | |||
154 | /* AC97 Status register (read only). | ||
155 | */ | ||
156 | #define PSC_AC97STAT_CB (1 << 26) | ||
157 | #define PSC_AC97STAT_CP (1 << 25) | ||
158 | #define PSC_AC97STAT_CR (1 << 24) | ||
159 | #define PSC_AC97STAT_RF (1 << 13) | ||
160 | #define PSC_AC97STAT_RE (1 << 12) | ||
161 | #define PSC_AC97STAT_RR (1 << 11) | ||
162 | #define PSC_AC97STAT_TF (1 << 10) | ||
163 | #define PSC_AC97STAT_TE (1 << 9) | ||
164 | #define PSC_AC97STAT_TR (1 << 8) | ||
165 | #define PSC_AC97STAT_RB (1 << 5) | ||
166 | #define PSC_AC97STAT_TB (1 << 4) | ||
167 | #define PSC_AC97STAT_DI (1 << 2) | ||
168 | #define PSC_AC97STAT_DR (1 << 1) | ||
169 | #define PSC_AC97STAT_SR (1 << 0) | ||
170 | |||
171 | /* AC97 Event Register. | ||
172 | */ | ||
173 | #define PSC_AC97EVNT_GR (1 << 25) | ||
174 | #define PSC_AC97EVNT_CD (1 << 24) | ||
175 | #define PSC_AC97EVNT_RR (1 << 13) | ||
176 | #define PSC_AC97EVNT_RO (1 << 12) | ||
177 | #define PSC_AC97EVNT_RU (1 << 11) | ||
178 | #define PSC_AC97EVNT_TR (1 << 10) | ||
179 | #define PSC_AC97EVNT_TO (1 << 9) | ||
180 | #define PSC_AC97EVNT_TU (1 << 8) | ||
181 | #define PSC_AC97EVNT_RD (1 << 5) | ||
182 | #define PSC_AC97EVNT_TD (1 << 4) | ||
183 | |||
184 | /* CODEC Command Register. | ||
185 | */ | ||
186 | #define PSC_AC97CDC_RD (1 << 25) | ||
187 | #define PSC_AC97CDC_ID_MASK (3 << 23) | ||
188 | #define PSC_AC97CDC_INDX_MASK (0x7f << 16) | ||
189 | #define PSC_AC97CDC_ID(x) (((x) & 0x3) << 23) | ||
190 | #define PSC_AC97CDC_INDX(x) (((x) & 0x7f) << 16) | ||
191 | |||
192 | /* AC97 Reset Control Register. | ||
193 | */ | ||
194 | #define PSC_AC97RST_RST (1 << 1) | ||
195 | #define PSC_AC97RST_SNC (1 << 0) | ||
196 | |||
197 | |||
198 | /* PSC in I2S Mode. | ||
199 | */ | ||
200 | typedef struct psc_i2s { | ||
201 | u32 psc_sel; | ||
202 | u32 psc_ctrl; | ||
203 | u32 psc_i2scfg; | ||
204 | u32 psc_i2smsk; | ||
205 | u32 psc_i2spcr; | ||
206 | u32 psc_i2sstat; | ||
207 | u32 psc_i2sevent; | ||
208 | u32 psc_i2stxrx; | ||
209 | u32 psc_i2sudf; | ||
210 | } psc_i2s_t; | ||
211 | |||
212 | /* I2S Config Register. | ||
213 | */ | ||
214 | #define PSC_I2SCFG_RT_MASK (3 << 30) | ||
215 | #define PSC_I2SCFG_RT_FIFO1 (0 << 30) | ||
216 | #define PSC_I2SCFG_RT_FIFO2 (1 << 30) | ||
217 | #define PSC_I2SCFG_RT_FIFO4 (2 << 30) | ||
218 | #define PSC_I2SCFG_RT_FIFO8 (3 << 30) | ||
219 | |||
220 | #define PSC_I2SCFG_TT_MASK (3 << 28) | ||
221 | #define PSC_I2SCFG_TT_FIFO1 (0 << 28) | ||
222 | #define PSC_I2SCFG_TT_FIFO2 (1 << 28) | ||
223 | #define PSC_I2SCFG_TT_FIFO4 (2 << 28) | ||
224 | #define PSC_I2SCFG_TT_FIFO8 (3 << 28) | ||
225 | |||
226 | #define PSC_I2SCFG_DD_DISABLE (1 << 27) | ||
227 | #define PSC_I2SCFG_DE_ENABLE (1 << 26) | ||
228 | #define PSC_I2SCFG_SET_WS(x) (((((x) / 2) - 1) & 0x7f) << 16) | ||
229 | #define PSC_I2SCFG_WI (1 << 15) | ||
230 | |||
231 | #define PSC_I2SCFG_DIV_MASK (3 << 13) | ||
232 | #define PSC_I2SCFG_DIV2 (0 << 13) | ||
233 | #define PSC_I2SCFG_DIV4 (1 << 13) | ||
234 | #define PSC_I2SCFG_DIV8 (2 << 13) | ||
235 | #define PSC_I2SCFG_DIV16 (3 << 13) | ||
236 | |||
237 | #define PSC_I2SCFG_BI (1 << 12) | ||
238 | #define PSC_I2SCFG_BUF (1 << 11) | ||
239 | #define PSC_I2SCFG_MLJ (1 << 10) | ||
240 | #define PSC_I2SCFG_XM (1 << 9) | ||
241 | |||
242 | /* The word length equation is simply LEN+1. | ||
243 | */ | ||
244 | #define PSC_I2SCFG_SET_LEN(x) ((((x) - 1) & 0x1f) << 4) | ||
245 | #define PSC_I2SCFG_GET_LEN(x) ((((x) >> 4) & 0x1f) + 1) | ||
246 | |||
247 | #define PSC_I2SCFG_LB (1 << 2) | ||
248 | #define PSC_I2SCFG_MLF (1 << 1) | ||
249 | #define PSC_I2SCFG_MS (1 << 0) | ||
250 | |||
251 | /* I2S Mask Register. | ||
252 | */ | ||
253 | #define PSC_I2SMSK_RR (1 << 13) | ||
254 | #define PSC_I2SMSK_RO (1 << 12) | ||
255 | #define PSC_I2SMSK_RU (1 << 11) | ||
256 | #define PSC_I2SMSK_TR (1 << 10) | ||
257 | #define PSC_I2SMSK_TO (1 << 9) | ||
258 | #define PSC_I2SMSK_TU (1 << 8) | ||
259 | #define PSC_I2SMSK_RD (1 << 5) | ||
260 | #define PSC_I2SMSK_TD (1 << 4) | ||
261 | #define PSC_I2SMSK_ALLMASK (PSC_I2SMSK_RR | PSC_I2SMSK_RO | \ | ||
262 | PSC_I2SMSK_RU | PSC_I2SMSK_TR | \ | ||
263 | PSC_I2SMSK_TO | PSC_I2SMSK_TU | \ | ||
264 | PSC_I2SMSK_RD | PSC_I2SMSK_TD) | ||
265 | |||
266 | /* I2S Protocol Control Register. | ||
267 | */ | ||
268 | #define PSC_I2SPCR_RC (1 << 6) | ||
269 | #define PSC_I2SPCR_RP (1 << 5) | ||
270 | #define PSC_I2SPCR_RS (1 << 4) | ||
271 | #define PSC_I2SPCR_TC (1 << 2) | ||
272 | #define PSC_I2SPCR_TP (1 << 1) | ||
273 | #define PSC_I2SPCR_TS (1 << 0) | ||
274 | |||
275 | /* I2S Status register (read only). | ||
276 | */ | ||
277 | #define PSC_I2SSTAT_RF (1 << 13) | ||
278 | #define PSC_I2SSTAT_RE (1 << 12) | ||
279 | #define PSC_I2SSTAT_RR (1 << 11) | ||
280 | #define PSC_I2SSTAT_TF (1 << 10) | ||
281 | #define PSC_I2SSTAT_TE (1 << 9) | ||
282 | #define PSC_I2SSTAT_TR (1 << 8) | ||
283 | #define PSC_I2SSTAT_RB (1 << 5) | ||
284 | #define PSC_I2SSTAT_TB (1 << 4) | ||
285 | #define PSC_I2SSTAT_DI (1 << 2) | ||
286 | #define PSC_I2SSTAT_DR (1 << 1) | ||
287 | #define PSC_I2SSTAT_SR (1 << 0) | ||
288 | |||
289 | /* I2S Event Register. | ||
290 | */ | ||
291 | #define PSC_I2SEVNT_RR (1 << 13) | ||
292 | #define PSC_I2SEVNT_RO (1 << 12) | ||
293 | #define PSC_I2SEVNT_RU (1 << 11) | ||
294 | #define PSC_I2SEVNT_TR (1 << 10) | ||
295 | #define PSC_I2SEVNT_TO (1 << 9) | ||
296 | #define PSC_I2SEVNT_TU (1 << 8) | ||
297 | #define PSC_I2SEVNT_RD (1 << 5) | ||
298 | #define PSC_I2SEVNT_TD (1 << 4) | ||
299 | |||
300 | /* PSC in SPI Mode. | ||
301 | */ | ||
302 | typedef struct psc_spi { | ||
303 | u32 psc_sel; | ||
304 | u32 psc_ctrl; | ||
305 | u32 psc_spicfg; | ||
306 | u32 psc_spimsk; | ||
307 | u32 psc_spipcr; | ||
308 | u32 psc_spistat; | ||
309 | u32 psc_spievent; | ||
310 | u32 psc_spitxrx; | ||
311 | } psc_spi_t; | ||
312 | |||
313 | /* SPI Config Register. | ||
314 | */ | ||
315 | #define PSC_SPICFG_RT_MASK (3 << 30) | ||
316 | #define PSC_SPICFG_RT_FIFO1 (0 << 30) | ||
317 | #define PSC_SPICFG_RT_FIFO2 (1 << 30) | ||
318 | #define PSC_SPICFG_RT_FIFO4 (2 << 30) | ||
319 | #define PSC_SPICFG_RT_FIFO8 (3 << 30) | ||
320 | |||
321 | #define PSC_SPICFG_TT_MASK (3 << 28) | ||
322 | #define PSC_SPICFG_TT_FIFO1 (0 << 28) | ||
323 | #define PSC_SPICFG_TT_FIFO2 (1 << 28) | ||
324 | #define PSC_SPICFG_TT_FIFO4 (2 << 28) | ||
325 | #define PSC_SPICFG_TT_FIFO8 (3 << 28) | ||
326 | |||
327 | #define PSC_SPICFG_DD_DISABLE (1 << 27) | ||
328 | #define PSC_SPICFG_DE_ENABLE (1 << 26) | ||
329 | #define PSC_SPICFG_CLR_BAUD(x) ((x) & ~((0x3f) << 15)) | ||
330 | #define PSC_SPICFG_SET_BAUD(x) (((x) & 0x3f) << 15) | ||
331 | |||
332 | #define PSC_SPICFG_SET_DIV(x) (((x) & 0x03) << 13) | ||
333 | #define PSC_SPICFG_DIV2 0 | ||
334 | #define PSC_SPICFG_DIV4 1 | ||
335 | #define PSC_SPICFG_DIV8 2 | ||
336 | #define PSC_SPICFG_DIV16 3 | ||
337 | |||
338 | #define PSC_SPICFG_BI (1 << 12) | ||
339 | #define PSC_SPICFG_PSE (1 << 11) | ||
340 | #define PSC_SPICFG_CGE (1 << 10) | ||
341 | #define PSC_SPICFG_CDE (1 << 9) | ||
342 | |||
343 | #define PSC_SPICFG_CLR_LEN(x) ((x) & ~((0x1f) << 4)) | ||
344 | #define PSC_SPICFG_SET_LEN(x) (((x-1) & 0x1f) << 4) | ||
345 | |||
346 | #define PSC_SPICFG_LB (1 << 3) | ||
347 | #define PSC_SPICFG_MLF (1 << 1) | ||
348 | #define PSC_SPICFG_MO (1 << 0) | ||
349 | |||
350 | /* SPI Mask Register. | ||
351 | */ | ||
352 | #define PSC_SPIMSK_MM (1 << 16) | ||
353 | #define PSC_SPIMSK_RR (1 << 13) | ||
354 | #define PSC_SPIMSK_RO (1 << 12) | ||
355 | #define PSC_SPIMSK_RU (1 << 11) | ||
356 | #define PSC_SPIMSK_TR (1 << 10) | ||
357 | #define PSC_SPIMSK_TO (1 << 9) | ||
358 | #define PSC_SPIMSK_TU (1 << 8) | ||
359 | #define PSC_SPIMSK_SD (1 << 5) | ||
360 | #define PSC_SPIMSK_MD (1 << 4) | ||
361 | #define PSC_SPIMSK_ALLMASK (PSC_SPIMSK_MM | PSC_SPIMSK_RR | \ | ||
362 | PSC_SPIMSK_RO | PSC_SPIMSK_TO | \ | ||
363 | PSC_SPIMSK_TU | PSC_SPIMSK_SD | \ | ||
364 | PSC_SPIMSK_MD) | ||
365 | |||
366 | /* SPI Protocol Control Register. | ||
367 | */ | ||
368 | #define PSC_SPIPCR_RC (1 << 6) | ||
369 | #define PSC_SPIPCR_SP (1 << 5) | ||
370 | #define PSC_SPIPCR_SS (1 << 4) | ||
371 | #define PSC_SPIPCR_TC (1 << 2) | ||
372 | #define PSC_SPIPCR_MS (1 << 0) | ||
373 | |||
374 | /* SPI Status register (read only). | ||
375 | */ | ||
376 | #define PSC_SPISTAT_RF (1 << 13) | ||
377 | #define PSC_SPISTAT_RE (1 << 12) | ||
378 | #define PSC_SPISTAT_RR (1 << 11) | ||
379 | #define PSC_SPISTAT_TF (1 << 10) | ||
380 | #define PSC_SPISTAT_TE (1 << 9) | ||
381 | #define PSC_SPISTAT_TR (1 << 8) | ||
382 | #define PSC_SPISTAT_SB (1 << 5) | ||
383 | #define PSC_SPISTAT_MB (1 << 4) | ||
384 | #define PSC_SPISTAT_DI (1 << 2) | ||
385 | #define PSC_SPISTAT_DR (1 << 1) | ||
386 | #define PSC_SPISTAT_SR (1 << 0) | ||
387 | |||
388 | /* SPI Event Register. | ||
389 | */ | ||
390 | #define PSC_SPIEVNT_MM (1 << 16) | ||
391 | #define PSC_SPIEVNT_RR (1 << 13) | ||
392 | #define PSC_SPIEVNT_RO (1 << 12) | ||
393 | #define PSC_SPIEVNT_RU (1 << 11) | ||
394 | #define PSC_SPIEVNT_TR (1 << 10) | ||
395 | #define PSC_SPIEVNT_TO (1 << 9) | ||
396 | #define PSC_SPIEVNT_TU (1 << 8) | ||
397 | #define PSC_SPIEVNT_SD (1 << 5) | ||
398 | #define PSC_SPIEVNT_MD (1 << 4) | ||
399 | |||
400 | /* Transmit register control. | ||
401 | */ | ||
402 | #define PSC_SPITXRX_LC (1 << 29) | ||
403 | #define PSC_SPITXRX_SR (1 << 28) | ||
404 | |||
405 | /* PSC in SMBus (I2C) Mode. | ||
406 | */ | ||
407 | typedef struct psc_smb { | ||
408 | u32 psc_sel; | ||
409 | u32 psc_ctrl; | ||
410 | u32 psc_smbcfg; | ||
411 | u32 psc_smbmsk; | ||
412 | u32 psc_smbpcr; | ||
413 | u32 psc_smbstat; | ||
414 | u32 psc_smbevnt; | ||
415 | u32 psc_smbtxrx; | ||
416 | u32 psc_smbtmr; | ||
417 | } psc_smb_t; | ||
418 | |||
419 | /* SMBus Config Register. | ||
420 | */ | ||
421 | #define PSC_SMBCFG_RT_MASK (3 << 30) | ||
422 | #define PSC_SMBCFG_RT_FIFO1 (0 << 30) | ||
423 | #define PSC_SMBCFG_RT_FIFO2 (1 << 30) | ||
424 | #define PSC_SMBCFG_RT_FIFO4 (2 << 30) | ||
425 | #define PSC_SMBCFG_RT_FIFO8 (3 << 30) | ||
426 | |||
427 | #define PSC_SMBCFG_TT_MASK (3 << 28) | ||
428 | #define PSC_SMBCFG_TT_FIFO1 (0 << 28) | ||
429 | #define PSC_SMBCFG_TT_FIFO2 (1 << 28) | ||
430 | #define PSC_SMBCFG_TT_FIFO4 (2 << 28) | ||
431 | #define PSC_SMBCFG_TT_FIFO8 (3 << 28) | ||
432 | |||
433 | #define PSC_SMBCFG_DD_DISABLE (1 << 27) | ||
434 | #define PSC_SMBCFG_DE_ENABLE (1 << 26) | ||
435 | |||
436 | #define PSC_SMBCFG_SET_DIV(x) (((x) & 0x03) << 13) | ||
437 | #define PSC_SMBCFG_DIV2 0 | ||
438 | #define PSC_SMBCFG_DIV4 1 | ||
439 | #define PSC_SMBCFG_DIV8 2 | ||
440 | #define PSC_SMBCFG_DIV16 3 | ||
441 | |||
442 | #define PSC_SMBCFG_GCE (1 << 9) | ||
443 | #define PSC_SMBCFG_SFM (1 << 8) | ||
444 | |||
445 | #define PSC_SMBCFG_SET_SLV(x) (((x) & 0x7f) << 1) | ||
446 | |||
447 | /* SMBus Mask Register. | ||
448 | */ | ||
449 | #define PSC_SMBMSK_DN (1 << 30) | ||
450 | #define PSC_SMBMSK_AN (1 << 29) | ||
451 | #define PSC_SMBMSK_AL (1 << 28) | ||
452 | #define PSC_SMBMSK_RR (1 << 13) | ||
453 | #define PSC_SMBMSK_RO (1 << 12) | ||
454 | #define PSC_SMBMSK_RU (1 << 11) | ||
455 | #define PSC_SMBMSK_TR (1 << 10) | ||
456 | #define PSC_SMBMSK_TO (1 << 9) | ||
457 | #define PSC_SMBMSK_TU (1 << 8) | ||
458 | #define PSC_SMBMSK_SD (1 << 5) | ||
459 | #define PSC_SMBMSK_MD (1 << 4) | ||
460 | #define PSC_SMBMSK_ALLMASK (PSC_SMBMSK_DN | PSC_SMBMSK_AN | \ | ||
461 | PSC_SMBMSK_AL | PSC_SMBMSK_RR | \ | ||
462 | PSC_SMBMSK_RO | PSC_SMBMSK_TO | \ | ||
463 | PSC_SMBMSK_TU | PSC_SMBMSK_SD | \ | ||
464 | PSC_SMBMSK_MD) | ||
465 | |||
466 | /* SMBus Protocol Control Register. | ||
467 | */ | ||
468 | #define PSC_SMBPCR_DC (1 << 2) | ||
469 | #define PSC_SMBPCR_MS (1 << 0) | ||
470 | |||
471 | /* SMBus Status register (read only). | ||
472 | */ | ||
473 | #define PSC_SMBSTAT_BB (1 << 28) | ||
474 | #define PSC_SMBSTAT_RF (1 << 13) | ||
475 | #define PSC_SMBSTAT_RE (1 << 12) | ||
476 | #define PSC_SMBSTAT_RR (1 << 11) | ||
477 | #define PSC_SMBSTAT_TF (1 << 10) | ||
478 | #define PSC_SMBSTAT_TE (1 << 9) | ||
479 | #define PSC_SMBSTAT_TR (1 << 8) | ||
480 | #define PSC_SMBSTAT_SB (1 << 5) | ||
481 | #define PSC_SMBSTAT_MB (1 << 4) | ||
482 | #define PSC_SMBSTAT_DI (1 << 2) | ||
483 | #define PSC_SMBSTAT_DR (1 << 1) | ||
484 | #define PSC_SMBSTAT_SR (1 << 0) | ||
485 | |||
486 | /* SMBus Event Register. | ||
487 | */ | ||
488 | #define PSC_SMBEVNT_DN (1 << 30) | ||
489 | #define PSC_SMBEVNT_AN (1 << 29) | ||
490 | #define PSC_SMBEVNT_AL (1 << 28) | ||
491 | #define PSC_SMBEVNT_RR (1 << 13) | ||
492 | #define PSC_SMBEVNT_RO (1 << 12) | ||
493 | #define PSC_SMBEVNT_RU (1 << 11) | ||
494 | #define PSC_SMBEVNT_TR (1 << 10) | ||
495 | #define PSC_SMBEVNT_TO (1 << 9) | ||
496 | #define PSC_SMBEVNT_TU (1 << 8) | ||
497 | #define PSC_SMBEVNT_SD (1 << 5) | ||
498 | #define PSC_SMBEVNT_MD (1 << 4) | ||
499 | #define PSC_SMBEVNT_ALLCLR (PSC_SMBEVNT_DN | PSC_SMBEVNT_AN | \ | ||
500 | PSC_SMBEVNT_AL | PSC_SMBEVNT_RR | \ | ||
501 | PSC_SMBEVNT_RO | PSC_SMBEVNT_TO | \ | ||
502 | PSC_SMBEVNT_TU | PSC_SMBEVNT_SD | \ | ||
503 | PSC_SMBEVNT_MD) | ||
504 | |||
505 | /* Transmit register control. | ||
506 | */ | ||
507 | #define PSC_SMBTXRX_RSR (1 << 30) | ||
508 | #define PSC_SMBTXRX_STP (1 << 29) | ||
509 | #define PSC_SMBTXRX_DATAMASK (0xff) | ||
510 | |||
511 | /* SMBus protocol timers register. | ||
512 | */ | ||
513 | #define PSC_SMBTMR_SET_TH(x) (((x) & 0x3) << 30) | ||
514 | #define PSC_SMBTMR_SET_PS(x) (((x) & 0x1f) << 25) | ||
515 | #define PSC_SMBTMR_SET_PU(x) (((x) & 0x1f) << 20) | ||
516 | #define PSC_SMBTMR_SET_SH(x) (((x) & 0x1f) << 15) | ||
517 | #define PSC_SMBTMR_SET_SU(x) (((x) & 0x1f) << 10) | ||
518 | #define PSC_SMBTMR_SET_CL(x) (((x) & 0x1f) << 5) | ||
519 | #define PSC_SMBTMR_SET_CH(x) (((x) & 0x1f) << 0) | ||
520 | |||
521 | |||
522 | #endif /* _AU1000_PSC_H_ */ | ||
diff --git a/include/asm-mips/mach-au1x00/timex.h b/include/asm-mips/mach-au1x00/timex.h new file mode 100644 index 000000000000..e3ada66cb636 --- /dev/null +++ b/include/asm-mips/mach-au1x00/timex.h | |||
@@ -0,0 +1,13 @@ | |||
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) 2003 by Ralf Baechle | ||
7 | */ | ||
8 | #ifndef __ASM_MACH_AU1X00_TIMEX_H | ||
9 | #define __ASM_MACH_AU1X00_TIMEX_H | ||
10 | |||
11 | #define CLOCK_TICK_RATE ((HZ * 100000UL) / 2) | ||
12 | |||
13 | #endif /* __ASM_MACH_AU1X00_TIMEX_H */ | ||