]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - include/asm-mips/mach-au1x00/au1000.h
[MIPS] Alchemy: Get rid of au_ffs().
[linux-2.6-omap-h63xx.git] / include / asm-mips / mach-au1x00 / au1000.h
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
39 #ifndef _LANGUAGE_ASSEMBLY
40
41 #include <linux/delay.h>
42 #include <linux/types.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, unsigned long reg)
64 {
65         *(volatile u8 *)(reg) = val;
66 }
67
68 void static inline au_writew(u16 val, unsigned long reg)
69 {
70         *(volatile u16 *)(reg) = val;
71 }
72
73 void static inline au_writel(u32 val, unsigned long reg)
74 {
75         *(volatile u32 *)(reg) = val;
76 }
77
78 static inline u8 au_readb(unsigned long reg)
79 {
80         return (*(volatile u8 *)reg);
81 }
82
83 static inline u16 au_readw(unsigned long reg)
84 {
85         return (*(volatile u16 *)reg);
86 }
87
88 static inline u32 au_readl(unsigned long reg)
89 {
90         return (*(volatile u32 *)reg);
91 }
92
93
94 static __inline__ int au_ffz(unsigned int x)
95 {
96         if ((x = ~x) == 0)
97                 return 32;
98         return __ilog2(x & -x);
99 }
100
101 /* arch/mips/au1000/common/clocks.c */
102 extern void set_au1x00_speed(unsigned int new_freq);
103 extern unsigned int get_au1x00_speed(void);
104 extern void set_au1x00_uart_baud_base(unsigned long new_baud_base);
105 extern unsigned long get_au1x00_uart_baud_base(void);
106 extern void set_au1x00_lcd_clock(void);
107 extern unsigned int get_au1x00_lcd_clock(void);
108
109 /*
110  * Every board describes its IRQ mapping with this table.
111  */
112 typedef struct au1xxx_irqmap {
113         int     im_irq;
114         int     im_type;
115         int     im_request;
116 } au1xxx_irq_map_t;
117
118 /*
119  * init_IRQ looks for a table with this name.
120  */
121 extern au1xxx_irq_map_t au1xxx_irq_map[];
122
123 #endif /* !defined (_LANGUAGE_ASSEMBLY) */
124
125 #ifdef CONFIG_PM
126 /* no CP0 timer irq */
127 #define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4)
128 #else
129 #define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5)
130 #endif
131
132 /*
133  * SDRAM Register Offsets
134  */
135 #if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1100)
136 #define MEM_SDMODE0             (0x0000)
137 #define MEM_SDMODE1             (0x0004)
138 #define MEM_SDMODE2             (0x0008)
139 #define MEM_SDADDR0             (0x000C)
140 #define MEM_SDADDR1             (0x0010)
141 #define MEM_SDADDR2             (0x0014)
142 #define MEM_SDREFCFG    (0x0018)
143 #define MEM_SDPRECMD    (0x001C)
144 #define MEM_SDAUTOREF   (0x0020)
145 #define MEM_SDWRMD0             (0x0024)
146 #define MEM_SDWRMD1             (0x0028)
147 #define MEM_SDWRMD2             (0x002C)
148 #define MEM_SDSLEEP             (0x0030)
149 #define MEM_SDSMCKE             (0x0034)
150
151 /*
152  * MEM_SDMODE register content definitions
153  */
154 #define MEM_SDMODE_F            (1<<22)
155 #define MEM_SDMODE_SR           (1<<21)
156 #define MEM_SDMODE_BS           (1<<20)
157 #define MEM_SDMODE_RS           (3<<18)
158 #define MEM_SDMODE_CS           (7<<15)
159 #define MEM_SDMODE_TRAS         (15<<11)
160 #define MEM_SDMODE_TMRD         (3<<9)
161 #define MEM_SDMODE_TWR          (3<<7)
162 #define MEM_SDMODE_TRP          (3<<5)
163 #define MEM_SDMODE_TRCD         (3<<3)
164 #define MEM_SDMODE_TCL          (7<<0)
165
166 #define MEM_SDMODE_BS_2Bank     (0<<20)
167 #define MEM_SDMODE_BS_4Bank     (1<<20)
168 #define MEM_SDMODE_RS_11Row     (0<<18)
169 #define MEM_SDMODE_RS_12Row     (1<<18)
170 #define MEM_SDMODE_RS_13Row     (2<<18)
171 #define MEM_SDMODE_RS_N(N)      ((N)<<18)
172 #define MEM_SDMODE_CS_7Col      (0<<15)
173 #define MEM_SDMODE_CS_8Col      (1<<15)
174 #define MEM_SDMODE_CS_9Col      (2<<15)
175 #define MEM_SDMODE_CS_10Col     (3<<15)
176 #define MEM_SDMODE_CS_11Col     (4<<15)
177 #define MEM_SDMODE_CS_N(N)              ((N)<<15)
178 #define MEM_SDMODE_TRAS_N(N)    ((N)<<11)
179 #define MEM_SDMODE_TMRD_N(N)    ((N)<<9)
180 #define MEM_SDMODE_TWR_N(N)             ((N)<<7)
181 #define MEM_SDMODE_TRP_N(N)             ((N)<<5)
182 #define MEM_SDMODE_TRCD_N(N)    ((N)<<3)
183 #define MEM_SDMODE_TCL_N(N)             ((N)<<0)
184
185 /*
186  * MEM_SDADDR register contents definitions
187  */
188 #define MEM_SDADDR_E                    (1<<20)
189 #define MEM_SDADDR_CSBA                 (0x03FF<<10)
190 #define MEM_SDADDR_CSMASK               (0x03FF<<0)
191 #define MEM_SDADDR_CSBA_N(N)    ((N)&(0x03FF<<22)>>12)
192 #define MEM_SDADDR_CSMASK_N(N)  ((N)&(0x03FF<<22)>>22)
193
194 /*
195  * MEM_SDREFCFG register content definitions
196  */
197 #define MEM_SDREFCFG_TRC                (15<<28)
198 #define MEM_SDREFCFG_TRPM               (3<<26)
199 #define MEM_SDREFCFG_E                  (1<<25)
200 #define MEM_SDREFCFG_RE                 (0x1ffffff<<0)
201 #define MEM_SDREFCFG_TRC_N(N)   ((N)<<MEM_SDREFCFG_TRC)
202 #define MEM_SDREFCFG_TRPM_N(N)  ((N)<<MEM_SDREFCFG_TRPM)
203 #define MEM_SDREFCFG_REF_N(N)   (N)
204 #endif
205
206 /***********************************************************************/
207
208 /*
209  * Au1550 SDRAM Register Offsets
210  */
211
212 /***********************************************************************/
213
214 #if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200)
215 #define MEM_SDMODE0             (0x0800)
216 #define MEM_SDMODE1             (0x0808)
217 #define MEM_SDMODE2             (0x0810)
218 #define MEM_SDADDR0             (0x0820)
219 #define MEM_SDADDR1             (0x0828)
220 #define MEM_SDADDR2             (0x0830)
221 #define MEM_SDCONFIGA   (0x0840)
222 #define MEM_SDCONFIGB   (0x0848)
223 #define MEM_SDSTAT              (0x0850)
224 #define MEM_SDERRADDR   (0x0858)
225 #define MEM_SDSTRIDE0   (0x0860)
226 #define MEM_SDSTRIDE1   (0x0868)
227 #define MEM_SDSTRIDE2   (0x0870)
228 #define MEM_SDWRMD0             (0x0880)
229 #define MEM_SDWRMD1             (0x0888)
230 #define MEM_SDWRMD2             (0x0890)
231 #define MEM_SDPRECMD    (0x08C0)
232 #define MEM_SDAUTOREF   (0x08C8)
233 #define MEM_SDSREF              (0x08D0)
234 #define MEM_SDSLEEP             MEM_SDSREF
235
236 #endif
237
238 /*
239  * Physical base addresses for integrated peripherals
240  */
241
242 #ifdef CONFIG_SOC_AU1000
243 #define MEM_PHYS_ADDR           0x14000000
244 #define STATIC_MEM_PHYS_ADDR    0x14001000
245 #define DMA0_PHYS_ADDR          0x14002000
246 #define DMA1_PHYS_ADDR          0x14002100
247 #define DMA2_PHYS_ADDR          0x14002200
248 #define DMA3_PHYS_ADDR          0x14002300
249 #define DMA4_PHYS_ADDR          0x14002400
250 #define DMA5_PHYS_ADDR          0x14002500
251 #define DMA6_PHYS_ADDR          0x14002600
252 #define DMA7_PHYS_ADDR          0x14002700
253 #define IC0_PHYS_ADDR           0x10400000
254 #define IC1_PHYS_ADDR           0x11800000
255 #define AC97_PHYS_ADDR          0x10000000
256 #define USBH_PHYS_ADDR          0x10100000
257 #define USBD_PHYS_ADDR          0x10200000
258 #define IRDA_PHYS_ADDR          0x10300000
259 #define MAC0_PHYS_ADDR          0x10500000
260 #define MAC1_PHYS_ADDR          0x10510000
261 #define MACEN_PHYS_ADDR         0x10520000
262 #define MACDMA0_PHYS_ADDR       0x14004000
263 #define MACDMA1_PHYS_ADDR       0x14004200
264 #define I2S_PHYS_ADDR           0x11000000
265 #define UART0_PHYS_ADDR         0x11100000
266 #define UART1_PHYS_ADDR         0x11200000
267 #define UART2_PHYS_ADDR         0x11300000
268 #define UART3_PHYS_ADDR         0x11400000
269 #define SSI0_PHYS_ADDR          0x11600000
270 #define SSI1_PHYS_ADDR          0x11680000
271 #define SYS_PHYS_ADDR           0x11900000
272 #define PCMCIA_IO_PHYS_ADDR   0xF00000000ULL
273 #define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
274 #define PCMCIA_MEM_PHYS_ADDR  0xF80000000ULL
275 #endif
276
277 /********************************************************************/
278
279 #ifdef CONFIG_SOC_AU1500
280 #define MEM_PHYS_ADDR           0x14000000
281 #define STATIC_MEM_PHYS_ADDR    0x14001000
282 #define DMA0_PHYS_ADDR          0x14002000
283 #define DMA1_PHYS_ADDR          0x14002100
284 #define DMA2_PHYS_ADDR          0x14002200
285 #define DMA3_PHYS_ADDR          0x14002300
286 #define DMA4_PHYS_ADDR          0x14002400
287 #define DMA5_PHYS_ADDR          0x14002500
288 #define DMA6_PHYS_ADDR          0x14002600
289 #define DMA7_PHYS_ADDR          0x14002700
290 #define IC0_PHYS_ADDR           0x10400000
291 #define IC1_PHYS_ADDR           0x11800000
292 #define AC97_PHYS_ADDR          0x10000000
293 #define USBH_PHYS_ADDR          0x10100000
294 #define USBD_PHYS_ADDR          0x10200000
295 #define PCI_PHYS_ADDR           0x14005000
296 #define MAC0_PHYS_ADDR          0x11500000
297 #define MAC1_PHYS_ADDR          0x11510000
298 #define MACEN_PHYS_ADDR         0x11520000
299 #define MACDMA0_PHYS_ADDR       0x14004000
300 #define MACDMA1_PHYS_ADDR       0x14004200
301 #define I2S_PHYS_ADDR           0x11000000
302 #define UART0_PHYS_ADDR         0x11100000
303 #define UART3_PHYS_ADDR         0x11400000
304 #define GPIO2_PHYS_ADDR         0x11700000
305 #define SYS_PHYS_ADDR           0x11900000
306 #define PCI_MEM_PHYS_ADDR     0x400000000ULL
307 #define PCI_IO_PHYS_ADDR      0x500000000ULL
308 #define PCI_CONFIG0_PHYS_ADDR 0x600000000ULL
309 #define PCI_CONFIG1_PHYS_ADDR 0x680000000ULL
310 #define PCMCIA_IO_PHYS_ADDR   0xF00000000ULL
311 #define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
312 #define PCMCIA_MEM_PHYS_ADDR  0xF80000000ULL
313 #endif
314
315 /********************************************************************/
316
317 #ifdef CONFIG_SOC_AU1100
318 #define MEM_PHYS_ADDR           0x14000000
319 #define STATIC_MEM_PHYS_ADDR    0x14001000
320 #define DMA0_PHYS_ADDR          0x14002000
321 #define DMA1_PHYS_ADDR          0x14002100
322 #define DMA2_PHYS_ADDR          0x14002200
323 #define DMA3_PHYS_ADDR          0x14002300
324 #define DMA4_PHYS_ADDR          0x14002400
325 #define DMA5_PHYS_ADDR          0x14002500
326 #define DMA6_PHYS_ADDR          0x14002600
327 #define DMA7_PHYS_ADDR          0x14002700
328 #define IC0_PHYS_ADDR           0x10400000
329 #define SD0_PHYS_ADDR           0x10600000
330 #define SD1_PHYS_ADDR           0x10680000
331 #define IC1_PHYS_ADDR           0x11800000
332 #define AC97_PHYS_ADDR          0x10000000
333 #define USBH_PHYS_ADDR          0x10100000
334 #define USBD_PHYS_ADDR          0x10200000
335 #define IRDA_PHYS_ADDR          0x10300000
336 #define MAC0_PHYS_ADDR          0x10500000
337 #define MACEN_PHYS_ADDR         0x10520000
338 #define MACDMA0_PHYS_ADDR       0x14004000
339 #define MACDMA1_PHYS_ADDR       0x14004200
340 #define I2S_PHYS_ADDR           0x11000000
341 #define UART0_PHYS_ADDR         0x11100000
342 #define UART1_PHYS_ADDR         0x11200000
343 #define UART3_PHYS_ADDR         0x11400000
344 #define SSI0_PHYS_ADDR          0x11600000
345 #define SSI1_PHYS_ADDR          0x11680000
346 #define GPIO2_PHYS_ADDR         0x11700000
347 #define SYS_PHYS_ADDR           0x11900000
348 #define LCD_PHYS_ADDR           0x15000000
349 #define PCMCIA_IO_PHYS_ADDR   0xF00000000ULL
350 #define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
351 #define PCMCIA_MEM_PHYS_ADDR  0xF80000000ULL
352 #endif
353
354 /***********************************************************************/
355
356 #ifdef CONFIG_SOC_AU1550
357 #define MEM_PHYS_ADDR           0x14000000
358 #define STATIC_MEM_PHYS_ADDR    0x14001000
359 #define IC0_PHYS_ADDR           0x10400000
360 #define IC1_PHYS_ADDR           0x11800000
361 #define USBH_PHYS_ADDR          0x14020000
362 #define USBD_PHYS_ADDR          0x10200000
363 #define PCI_PHYS_ADDR           0x14005000
364 #define MAC0_PHYS_ADDR          0x10500000
365 #define MAC1_PHYS_ADDR          0x10510000
366 #define MACEN_PHYS_ADDR         0x10520000
367 #define MACDMA0_PHYS_ADDR       0x14004000
368 #define MACDMA1_PHYS_ADDR       0x14004200
369 #define UART0_PHYS_ADDR         0x11100000
370 #define UART1_PHYS_ADDR         0x11200000
371 #define UART3_PHYS_ADDR         0x11400000
372 #define GPIO2_PHYS_ADDR         0x11700000
373 #define SYS_PHYS_ADDR           0x11900000
374 #define DDMA_PHYS_ADDR          0x14002000
375 #define PE_PHYS_ADDR            0x14008000
376 #define PSC0_PHYS_ADDR          0x11A00000
377 #define PSC1_PHYS_ADDR          0x11B00000
378 #define PSC2_PHYS_ADDR          0x10A00000
379 #define PSC3_PHYS_ADDR          0x10B00000
380 #define PCI_MEM_PHYS_ADDR     0x400000000ULL
381 #define PCI_IO_PHYS_ADDR      0x500000000ULL
382 #define PCI_CONFIG0_PHYS_ADDR 0x600000000ULL
383 #define PCI_CONFIG1_PHYS_ADDR 0x680000000ULL
384 #define PCMCIA_IO_PHYS_ADDR   0xF00000000ULL
385 #define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
386 #define PCMCIA_MEM_PHYS_ADDR  0xF80000000ULL
387 #endif
388
389 /***********************************************************************/
390
391 #ifdef CONFIG_SOC_AU1200
392 #define MEM_PHYS_ADDR           0x14000000
393 #define STATIC_MEM_PHYS_ADDR    0x14001000
394 #define AES_PHYS_ADDR           0x10300000
395 #define CIM_PHYS_ADDR           0x14004000
396 #define IC0_PHYS_ADDR           0x10400000
397 #define IC1_PHYS_ADDR           0x11800000
398 #define USBM_PHYS_ADDR          0x14020000
399 #define USBH_PHYS_ADDR          0x14020100
400 #define UART0_PHYS_ADDR         0x11100000
401 #define UART1_PHYS_ADDR         0x11200000
402 #define GPIO2_PHYS_ADDR         0x11700000
403 #define SYS_PHYS_ADDR           0x11900000
404 #define DDMA_PHYS_ADDR          0x14002000
405 #define PSC0_PHYS_ADDR          0x11A00000
406 #define PSC1_PHYS_ADDR          0x11B00000
407 #define SD0_PHYS_ADDR           0x10600000
408 #define SD1_PHYS_ADDR           0x10680000
409 #define LCD_PHYS_ADDR           0x15000000
410 #define SWCNT_PHYS_ADDR         0x1110010C
411 #define MAEFE_PHYS_ADDR         0x14012000
412 #define MAEBE_PHYS_ADDR         0x14010000
413 #define PCMCIA_IO_PHYS_ADDR   0xF00000000ULL
414 #define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
415 #define PCMCIA_MEM_PHYS_ADDR  0xF80000000ULL
416 #endif
417
418
419 /* Static Bus Controller */
420 #define MEM_STCFG0                 0xB4001000
421 #define MEM_STTIME0                0xB4001004
422 #define MEM_STADDR0                0xB4001008
423
424 #define MEM_STCFG1                 0xB4001010
425 #define MEM_STTIME1                0xB4001014
426 #define MEM_STADDR1                0xB4001018
427
428 #define MEM_STCFG2                 0xB4001020
429 #define MEM_STTIME2                0xB4001024
430 #define MEM_STADDR2                0xB4001028
431
432 #define MEM_STCFG3                 0xB4001030
433 #define MEM_STTIME3                0xB4001034
434 #define MEM_STADDR3                0xB4001038
435
436 #if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200)
437 #define MEM_STNDCTL                0xB4001100
438 #define MEM_STSTAT                 0xB4001104
439
440 #define MEM_STNAND_CMD                  (0x0)
441 #define MEM_STNAND_ADDR                 (0x4)
442 #define MEM_STNAND_DATA                (0x20)
443 #endif
444
445 /* Interrupt Controller 0 */
446 #define IC0_CFG0RD                 0xB0400040
447 #define IC0_CFG0SET                0xB0400040
448 #define IC0_CFG0CLR                0xB0400044
449
450 #define IC0_CFG1RD                 0xB0400048
451 #define IC0_CFG1SET                0xB0400048
452 #define IC0_CFG1CLR                0xB040004C
453
454 #define IC0_CFG2RD                 0xB0400050
455 #define IC0_CFG2SET                0xB0400050
456 #define IC0_CFG2CLR                0xB0400054
457
458 #define IC0_REQ0INT                0xB0400054
459 #define IC0_SRCRD                  0xB0400058
460 #define IC0_SRCSET                 0xB0400058
461 #define IC0_SRCCLR                 0xB040005C
462 #define IC0_REQ1INT                0xB040005C
463
464 #define IC0_ASSIGNRD               0xB0400060
465 #define IC0_ASSIGNSET              0xB0400060
466 #define IC0_ASSIGNCLR              0xB0400064
467
468 #define IC0_WAKERD                 0xB0400068
469 #define IC0_WAKESET                0xB0400068
470 #define IC0_WAKECLR                0xB040006C
471
472 #define IC0_MASKRD                 0xB0400070
473 #define IC0_MASKSET                0xB0400070
474 #define IC0_MASKCLR                0xB0400074
475
476 #define IC0_RISINGRD               0xB0400078
477 #define IC0_RISINGCLR              0xB0400078
478 #define IC0_FALLINGRD              0xB040007C
479 #define IC0_FALLINGCLR             0xB040007C
480
481 #define IC0_TESTBIT                0xB0400080
482
483 /* Interrupt Controller 1 */
484 #define IC1_CFG0RD                 0xB1800040
485 #define IC1_CFG0SET                0xB1800040
486 #define IC1_CFG0CLR                0xB1800044
487
488 #define IC1_CFG1RD                 0xB1800048
489 #define IC1_CFG1SET                0xB1800048
490 #define IC1_CFG1CLR                0xB180004C
491
492 #define IC1_CFG2RD                 0xB1800050
493 #define IC1_CFG2SET                0xB1800050
494 #define IC1_CFG2CLR                0xB1800054
495
496 #define IC1_REQ0INT                0xB1800054
497 #define IC1_SRCRD                  0xB1800058
498 #define IC1_SRCSET                 0xB1800058
499 #define IC1_SRCCLR                 0xB180005C
500 #define IC1_REQ1INT                0xB180005C
501
502 #define IC1_ASSIGNRD               0xB1800060
503 #define IC1_ASSIGNSET              0xB1800060
504 #define IC1_ASSIGNCLR              0xB1800064
505
506 #define IC1_WAKERD                 0xB1800068
507 #define IC1_WAKESET                0xB1800068
508 #define IC1_WAKECLR                0xB180006C
509
510 #define IC1_MASKRD                 0xB1800070
511 #define IC1_MASKSET                0xB1800070
512 #define IC1_MASKCLR                0xB1800074
513
514 #define IC1_RISINGRD               0xB1800078
515 #define IC1_RISINGCLR              0xB1800078
516 #define IC1_FALLINGRD              0xB180007C
517 #define IC1_FALLINGCLR             0xB180007C
518
519 #define IC1_TESTBIT                0xB1800080
520
521 /* Interrupt Configuration Modes */
522 #define INTC_INT_DISABLED                0
523 #define INTC_INT_RISE_EDGE             0x1
524 #define INTC_INT_FALL_EDGE             0x2
525 #define INTC_INT_RISE_AND_FALL_EDGE    0x3
526 #define INTC_INT_HIGH_LEVEL            0x5
527 #define INTC_INT_LOW_LEVEL             0x6
528 #define INTC_INT_HIGH_AND_LOW_LEVEL    0x7
529
530 /* Interrupt Numbers */
531 /* Au1000 */
532 #ifdef CONFIG_SOC_AU1000
533 #define AU1000_UART0_INT          0
534 #define AU1000_UART1_INT          1 /* au1000 */
535 #define AU1000_UART2_INT          2 /* au1000 */
536 #define AU1000_UART3_INT          3
537 #define AU1000_SSI0_INT           4 /* au1000 */
538 #define AU1000_SSI1_INT           5 /* au1000 */
539 #define AU1000_DMA_INT_BASE       6
540 #define AU1000_TOY_INT            14
541 #define AU1000_TOY_MATCH0_INT     15
542 #define AU1000_TOY_MATCH1_INT     16
543 #define AU1000_TOY_MATCH2_INT     17
544 #define AU1000_RTC_INT            18
545 #define AU1000_RTC_MATCH0_INT     19
546 #define AU1000_RTC_MATCH1_INT     20
547 #define AU1000_RTC_MATCH2_INT     21
548 #define AU1000_IRDA_TX_INT        22 /* au1000 */
549 #define AU1000_IRDA_RX_INT        23 /* au1000 */
550 #define AU1000_USB_DEV_REQ_INT    24
551 #define AU1000_USB_DEV_SUS_INT    25
552 #define AU1000_USB_HOST_INT       26
553 #define AU1000_ACSYNC_INT         27
554 #define AU1000_MAC0_DMA_INT       28
555 #define AU1000_MAC1_DMA_INT       29
556 #define AU1000_I2S_UO_INT         30 /* au1000 */
557 #define AU1000_AC97C_INT          31
558 #define AU1000_GPIO_0             32
559 #define AU1000_GPIO_1             33
560 #define AU1000_GPIO_2             34
561 #define AU1000_GPIO_3             35
562 #define AU1000_GPIO_4             36
563 #define AU1000_GPIO_5             37
564 #define AU1000_GPIO_6             38
565 #define AU1000_GPIO_7             39
566 #define AU1000_GPIO_8             40
567 #define AU1000_GPIO_9             41
568 #define AU1000_GPIO_10            42
569 #define AU1000_GPIO_11            43
570 #define AU1000_GPIO_12            44
571 #define AU1000_GPIO_13            45
572 #define AU1000_GPIO_14            46
573 #define AU1000_GPIO_15            47
574 #define AU1000_GPIO_16            48
575 #define AU1000_GPIO_17            49
576 #define AU1000_GPIO_18            50
577 #define AU1000_GPIO_19            51
578 #define AU1000_GPIO_20            52
579 #define AU1000_GPIO_21            53
580 #define AU1000_GPIO_22            54
581 #define AU1000_GPIO_23            55
582 #define AU1000_GPIO_24            56
583 #define AU1000_GPIO_25            57
584 #define AU1000_GPIO_26            58
585 #define AU1000_GPIO_27            59
586 #define AU1000_GPIO_28            60
587 #define AU1000_GPIO_29            61
588 #define AU1000_GPIO_30            62
589 #define AU1000_GPIO_31            63
590
591 #define UART0_ADDR                0xB1100000
592 #define UART1_ADDR                0xB1200000
593 #define UART2_ADDR                0xB1300000
594 #define UART3_ADDR                0xB1400000
595
596 #define USB_OHCI_BASE             0x10100000 // phys addr for ioremap
597 #define USB_HOST_CONFIG           0xB017fffc
598
599 #define AU1000_ETH0_BASE      0xB0500000
600 #define AU1000_ETH1_BASE      0xB0510000
601 #define AU1000_MAC0_ENABLE       0xB0520000
602 #define AU1000_MAC1_ENABLE       0xB0520004
603 #define NUM_ETH_INTERFACES 2
604 #endif /* CONFIG_SOC_AU1000 */
605
606 /* Au1500 */
607 #ifdef CONFIG_SOC_AU1500
608 #define AU1500_UART0_INT          0
609 #define AU1000_PCI_INTA           1 /* au1500 */
610 #define AU1000_PCI_INTB           2 /* au1500 */
611 #define AU1500_UART3_INT          3
612 #define AU1000_PCI_INTC           4 /* au1500 */
613 #define AU1000_PCI_INTD           5 /* au1500 */
614 #define AU1000_DMA_INT_BASE       6
615 #define AU1000_TOY_INT            14
616 #define AU1000_TOY_MATCH0_INT     15
617 #define AU1000_TOY_MATCH1_INT     16
618 #define AU1000_TOY_MATCH2_INT     17
619 #define AU1000_RTC_INT            18
620 #define AU1000_RTC_MATCH0_INT     19
621 #define AU1000_RTC_MATCH1_INT     20
622 #define AU1000_RTC_MATCH2_INT     21
623 #define AU1500_PCI_ERR_INT        22
624 #define AU1000_USB_DEV_REQ_INT    24
625 #define AU1000_USB_DEV_SUS_INT    25
626 #define AU1000_USB_HOST_INT       26
627 #define AU1000_ACSYNC_INT         27
628 #define AU1500_MAC0_DMA_INT       28
629 #define AU1500_MAC1_DMA_INT       29
630 #define AU1000_AC97C_INT          31
631 #define AU1000_GPIO_0             32
632 #define AU1000_GPIO_1             33
633 #define AU1000_GPIO_2             34
634 #define AU1000_GPIO_3             35
635 #define AU1000_GPIO_4             36
636 #define AU1000_GPIO_5             37
637 #define AU1000_GPIO_6             38
638 #define AU1000_GPIO_7             39
639 #define AU1000_GPIO_8             40
640 #define AU1000_GPIO_9             41
641 #define AU1000_GPIO_10            42
642 #define AU1000_GPIO_11            43
643 #define AU1000_GPIO_12            44
644 #define AU1000_GPIO_13            45
645 #define AU1000_GPIO_14            46
646 #define AU1000_GPIO_15            47
647 #define AU1500_GPIO_200           48
648 #define AU1500_GPIO_201           49
649 #define AU1500_GPIO_202           50
650 #define AU1500_GPIO_203           51
651 #define AU1500_GPIO_20            52
652 #define AU1500_GPIO_204           53
653 #define AU1500_GPIO_205           54
654 #define AU1500_GPIO_23            55
655 #define AU1500_GPIO_24            56
656 #define AU1500_GPIO_25            57
657 #define AU1500_GPIO_26            58
658 #define AU1500_GPIO_27            59
659 #define AU1500_GPIO_28            60
660 #define AU1500_GPIO_206           61
661 #define AU1500_GPIO_207           62
662 #define AU1500_GPIO_208_215       63
663
664 /* shortcuts */
665 #define INTA AU1000_PCI_INTA
666 #define INTB AU1000_PCI_INTB
667 #define INTC AU1000_PCI_INTC
668 #define INTD AU1000_PCI_INTD
669
670 #define UART0_ADDR                0xB1100000
671 #define UART3_ADDR                0xB1400000
672
673 #define USB_OHCI_BASE             0x10100000 // phys addr for ioremap
674 #define USB_HOST_CONFIG           0xB017fffc
675
676 #define AU1500_ETH0_BASE          0xB1500000
677 #define AU1500_ETH1_BASE          0xB1510000
678 #define AU1500_MAC0_ENABLE       0xB1520000
679 #define AU1500_MAC1_ENABLE       0xB1520004
680 #define NUM_ETH_INTERFACES 2
681 #endif /* CONFIG_SOC_AU1500 */
682
683 /* Au1100 */
684 #ifdef CONFIG_SOC_AU1100
685 #define AU1100_UART0_INT          0
686 #define AU1100_UART1_INT          1
687 #define AU1100_SD_INT             2
688 #define AU1100_UART3_INT          3
689 #define AU1000_SSI0_INT           4
690 #define AU1000_SSI1_INT           5
691 #define AU1000_DMA_INT_BASE       6
692 #define AU1000_TOY_INT            14
693 #define AU1000_TOY_MATCH0_INT     15
694 #define AU1000_TOY_MATCH1_INT     16
695 #define AU1000_TOY_MATCH2_INT     17
696 #define AU1000_RTC_INT            18
697 #define AU1000_RTC_MATCH0_INT     19
698 #define AU1000_RTC_MATCH1_INT     20
699 #define AU1000_RTC_MATCH2_INT     21
700 #define AU1000_IRDA_TX_INT        22
701 #define AU1000_IRDA_RX_INT        23
702 #define AU1000_USB_DEV_REQ_INT    24
703 #define AU1000_USB_DEV_SUS_INT    25
704 #define AU1000_USB_HOST_INT       26
705 #define AU1000_ACSYNC_INT         27
706 #define AU1100_MAC0_DMA_INT       28
707 #define AU1100_GPIO_208_215     29
708 #define AU1100_LCD_INT            30
709 #define AU1000_AC97C_INT          31
710 #define AU1000_GPIO_0             32
711 #define AU1000_GPIO_1             33
712 #define AU1000_GPIO_2             34
713 #define AU1000_GPIO_3             35
714 #define AU1000_GPIO_4             36
715 #define AU1000_GPIO_5             37
716 #define AU1000_GPIO_6             38
717 #define AU1000_GPIO_7             39
718 #define AU1000_GPIO_8             40
719 #define AU1000_GPIO_9             41
720 #define AU1000_GPIO_10            42
721 #define AU1000_GPIO_11            43
722 #define AU1000_GPIO_12            44
723 #define AU1000_GPIO_13            45
724 #define AU1000_GPIO_14            46
725 #define AU1000_GPIO_15            47
726 #define AU1000_GPIO_16            48
727 #define AU1000_GPIO_17            49
728 #define AU1000_GPIO_18            50
729 #define AU1000_GPIO_19            51
730 #define AU1000_GPIO_20            52
731 #define AU1000_GPIO_21            53
732 #define AU1000_GPIO_22            54
733 #define AU1000_GPIO_23            55
734 #define AU1000_GPIO_24            56
735 #define AU1000_GPIO_25            57
736 #define AU1000_GPIO_26            58
737 #define AU1000_GPIO_27            59
738 #define AU1000_GPIO_28            60
739 #define AU1000_GPIO_29            61
740 #define AU1000_GPIO_30            62
741 #define AU1000_GPIO_31            63
742
743 #define UART0_ADDR                0xB1100000
744 #define UART1_ADDR                0xB1200000
745 #define UART3_ADDR                0xB1400000
746
747 #define USB_OHCI_BASE             0x10100000 // phys addr for ioremap
748 #define USB_HOST_CONFIG           0xB017fffc
749
750 #define AU1100_ETH0_BASE          0xB0500000
751 #define AU1100_MAC0_ENABLE       0xB0520000
752 #define NUM_ETH_INTERFACES 1
753 #endif /* CONFIG_SOC_AU1100 */
754
755 #ifdef CONFIG_SOC_AU1550
756 #define AU1550_UART0_INT          0
757 #define AU1550_PCI_INTA           1
758 #define AU1550_PCI_INTB           2
759 #define AU1550_DDMA_INT           3
760 #define AU1550_CRYPTO_INT         4
761 #define AU1550_PCI_INTC           5
762 #define AU1550_PCI_INTD           6
763 #define AU1550_PCI_RST_INT        7
764 #define AU1550_UART1_INT          8
765 #define AU1550_UART3_INT          9
766 #define AU1550_PSC0_INT           10
767 #define AU1550_PSC1_INT           11
768 #define AU1550_PSC2_INT           12
769 #define AU1550_PSC3_INT           13
770 #define AU1000_TOY_INT                    14
771 #define AU1000_TOY_MATCH0_INT     15
772 #define AU1000_TOY_MATCH1_INT     16
773 #define AU1000_TOY_MATCH2_INT     17
774 #define AU1000_RTC_INT            18
775 #define AU1000_RTC_MATCH0_INT     19
776 #define AU1000_RTC_MATCH1_INT     20
777 #define AU1000_RTC_MATCH2_INT     21
778 #define AU1550_NAND_INT           23
779 #define AU1550_USB_DEV_REQ_INT    24
780 #define AU1550_USB_DEV_SUS_INT    25
781 #define AU1550_USB_HOST_INT       26
782 #define AU1000_USB_DEV_REQ_INT    AU1550_USB_DEV_REQ_INT
783 #define AU1000_USB_DEV_SUS_INT    AU1550_USB_DEV_SUS_INT
784 #define AU1000_USB_HOST_INT       AU1550_USB_HOST_INT
785 #define AU1550_MAC0_DMA_INT       27
786 #define AU1550_MAC1_DMA_INT       28
787 #define AU1000_GPIO_0             32
788 #define AU1000_GPIO_1             33
789 #define AU1000_GPIO_2             34
790 #define AU1000_GPIO_3             35
791 #define AU1000_GPIO_4             36
792 #define AU1000_GPIO_5             37
793 #define AU1000_GPIO_6             38
794 #define AU1000_GPIO_7             39
795 #define AU1000_GPIO_8             40
796 #define AU1000_GPIO_9             41
797 #define AU1000_GPIO_10            42
798 #define AU1000_GPIO_11            43
799 #define AU1000_GPIO_12            44
800 #define AU1000_GPIO_13            45
801 #define AU1000_GPIO_14            46
802 #define AU1000_GPIO_15            47
803 #define AU1550_GPIO_200           48
804 #define AU1500_GPIO_201_205       49    // Logical or of GPIO201:205
805 #define AU1500_GPIO_16            50
806 #define AU1500_GPIO_17            51
807 #define AU1500_GPIO_20            52
808 #define AU1500_GPIO_21            53
809 #define AU1500_GPIO_22            54
810 #define AU1500_GPIO_23            55
811 #define AU1500_GPIO_24            56
812 #define AU1500_GPIO_25            57
813 #define AU1500_GPIO_26            58
814 #define AU1500_GPIO_27            59
815 #define AU1500_GPIO_28            60
816 #define AU1500_GPIO_206           61
817 #define AU1500_GPIO_207           62
818 #define AU1500_GPIO_208_218       63    // Logical or of GPIO208:218
819
820 /* shortcuts */
821 #define INTA AU1550_PCI_INTA
822 #define INTB AU1550_PCI_INTB
823 #define INTC AU1550_PCI_INTC
824 #define INTD AU1550_PCI_INTD
825
826 #define UART0_ADDR                0xB1100000
827 #define UART1_ADDR                0xB1200000
828 #define UART3_ADDR                0xB1400000
829
830 #define USB_OHCI_BASE             0x14020000 // phys addr for ioremap
831 #define USB_OHCI_LEN              0x00060000
832 #define USB_HOST_CONFIG           0xB4027ffc
833
834 #define AU1550_ETH0_BASE      0xB0500000
835 #define AU1550_ETH1_BASE      0xB0510000
836 #define AU1550_MAC0_ENABLE       0xB0520000
837 #define AU1550_MAC1_ENABLE       0xB0520004
838 #define NUM_ETH_INTERFACES 2
839 #endif /* CONFIG_SOC_AU1550 */
840
841 #ifdef CONFIG_SOC_AU1200
842 #define AU1200_UART0_INT          0
843 #define AU1200_SWT_INT            1
844 #define AU1200_SD_INT             2
845 #define AU1200_DDMA_INT           3
846 #define AU1200_MAE_BE_INT         4
847 #define AU1200_GPIO_200           5
848 #define AU1200_GPIO_201           6
849 #define AU1200_GPIO_202           7
850 #define AU1200_UART1_INT          8
851 #define AU1200_MAE_FE_INT         9
852 #define AU1200_PSC0_INT           10
853 #define AU1200_PSC1_INT           11
854 #define AU1200_AES_INT            12
855 #define AU1200_CAMERA_INT         13
856 #define AU1000_TOY_INT                    14
857 #define AU1000_TOY_MATCH0_INT     15
858 #define AU1000_TOY_MATCH1_INT     16
859 #define AU1000_TOY_MATCH2_INT     17
860 #define AU1000_RTC_INT            18
861 #define AU1000_RTC_MATCH0_INT     19
862 #define AU1000_RTC_MATCH1_INT     20
863 #define AU1000_RTC_MATCH2_INT     21
864 #define AU1200_NAND_INT           23
865 #define AU1200_GPIO_204           24
866 #define AU1200_GPIO_205           25
867 #define AU1200_GPIO_206           26
868 #define AU1200_GPIO_207           27
869 #define AU1200_GPIO_208_215       28 // Logical OR of 208:215
870 #define AU1200_USB_INT            29
871 #define AU1000_USB_HOST_INT               AU1200_USB_INT
872 #define AU1200_LCD_INT            30
873 #define AU1200_MAE_BOTH_INT       31
874 #define AU1000_GPIO_0             32
875 #define AU1000_GPIO_1             33
876 #define AU1000_GPIO_2             34
877 #define AU1000_GPIO_3             35
878 #define AU1000_GPIO_4             36
879 #define AU1000_GPIO_5             37
880 #define AU1000_GPIO_6             38
881 #define AU1000_GPIO_7             39
882 #define AU1000_GPIO_8             40
883 #define AU1000_GPIO_9             41
884 #define AU1000_GPIO_10            42
885 #define AU1000_GPIO_11            43
886 #define AU1000_GPIO_12            44
887 #define AU1000_GPIO_13            45
888 #define AU1000_GPIO_14            46
889 #define AU1000_GPIO_15            47
890 #define AU1000_GPIO_16            48
891 #define AU1000_GPIO_17            49
892 #define AU1000_GPIO_18            50
893 #define AU1000_GPIO_19            51
894 #define AU1000_GPIO_20            52
895 #define AU1000_GPIO_21            53
896 #define AU1000_GPIO_22            54
897 #define AU1000_GPIO_23            55
898 #define AU1000_GPIO_24            56
899 #define AU1000_GPIO_25            57
900 #define AU1000_GPIO_26            58
901 #define AU1000_GPIO_27            59
902 #define AU1000_GPIO_28            60
903 #define AU1000_GPIO_29            61
904 #define AU1000_GPIO_30            62
905 #define AU1000_GPIO_31            63
906
907 #define UART0_ADDR                0xB1100000
908 #define UART1_ADDR                0xB1200000
909
910 #define USB_UOC_BASE              0x14020020
911 #define USB_UOC_LEN               0x20
912 #define USB_OHCI_BASE             0x14020100
913 #define USB_OHCI_LEN              0x100
914 #define USB_EHCI_BASE             0x14020200
915 #define USB_EHCI_LEN              0x100
916 #define USB_UDC_BASE              0x14022000
917 #define USB_UDC_LEN               0x2000
918 #define USB_MSR_BASE                      0xB4020000
919 #define USB_MSR_MCFG              4
920 #define USBMSRMCFG_OMEMEN         0
921 #define USBMSRMCFG_OBMEN          1
922 #define USBMSRMCFG_EMEMEN         2
923 #define USBMSRMCFG_EBMEN          3
924 #define USBMSRMCFG_DMEMEN         4
925 #define USBMSRMCFG_DBMEN          5
926 #define USBMSRMCFG_GMEMEN         6
927 #define USBMSRMCFG_OHCCLKEN       16
928 #define USBMSRMCFG_EHCCLKEN       17
929 #define USBMSRMCFG_UDCCLKEN       18
930 #define USBMSRMCFG_PHYPLLEN       19
931 #define USBMSRMCFG_RDCOMB         30
932 #define USBMSRMCFG_PFEN           31
933
934 #endif /* CONFIG_SOC_AU1200 */
935
936 #define AU1000_LAST_INTC0_INT     31
937 #define AU1000_LAST_INTC1_INT     63
938 #define AU1000_MAX_INTR           63
939 #define INTX                    0xFF /* not valid */
940
941 /* Programmable Counters 0 and 1 */
942 #define SYS_BASE                   0xB1900000
943 #define SYS_COUNTER_CNTRL          (SYS_BASE + 0x14)
944 #  define SYS_CNTRL_E1S            (1<<23)
945 #  define SYS_CNTRL_T1S            (1<<20)
946 #  define SYS_CNTRL_M21            (1<<19)
947 #  define SYS_CNTRL_M11            (1<<18)
948 #  define SYS_CNTRL_M01            (1<<17)
949 #  define SYS_CNTRL_C1S            (1<<16)
950 #  define SYS_CNTRL_BP             (1<<14)
951 #  define SYS_CNTRL_EN1            (1<<13)
952 #  define SYS_CNTRL_BT1            (1<<12)
953 #  define SYS_CNTRL_EN0            (1<<11)
954 #  define SYS_CNTRL_BT0            (1<<10)
955 #  define SYS_CNTRL_E0             (1<<8)
956 #  define SYS_CNTRL_E0S            (1<<7)
957 #  define SYS_CNTRL_32S            (1<<5)
958 #  define SYS_CNTRL_T0S            (1<<4)
959 #  define SYS_CNTRL_M20            (1<<3)
960 #  define SYS_CNTRL_M10            (1<<2)
961 #  define SYS_CNTRL_M00            (1<<1)
962 #  define SYS_CNTRL_C0S            (1<<0)
963
964 /* Programmable Counter 0 Registers */
965 #define SYS_TOYTRIM                 (SYS_BASE + 0)
966 #define SYS_TOYWRITE                (SYS_BASE + 4)
967 #define SYS_TOYMATCH0               (SYS_BASE + 8)
968 #define SYS_TOYMATCH1               (SYS_BASE + 0xC)
969 #define SYS_TOYMATCH2               (SYS_BASE + 0x10)
970 #define SYS_TOYREAD                 (SYS_BASE + 0x40)
971
972 /* Programmable Counter 1 Registers */
973 #define SYS_RTCTRIM                 (SYS_BASE + 0x44)
974 #define SYS_RTCWRITE                (SYS_BASE + 0x48)
975 #define SYS_RTCMATCH0               (SYS_BASE + 0x4C)
976 #define SYS_RTCMATCH1               (SYS_BASE + 0x50)
977 #define SYS_RTCMATCH2               (SYS_BASE + 0x54)
978 #define SYS_RTCREAD                 (SYS_BASE + 0x58)
979
980 /* I2S Controller */
981 #define I2S_DATA                    0xB1000000
982 #  define I2S_DATA_MASK        (0xffffff)
983 #define I2S_CONFIG                0xB1000004
984 #  define I2S_CONFIG_XU        (1<<25)
985 #  define I2S_CONFIG_XO        (1<<24)
986 #  define I2S_CONFIG_RU        (1<<23)
987 #  define I2S_CONFIG_RO        (1<<22)
988 #  define I2S_CONFIG_TR        (1<<21)
989 #  define I2S_CONFIG_TE        (1<<20)
990 #  define I2S_CONFIG_TF        (1<<19)
991 #  define I2S_CONFIG_RR        (1<<18)
992 #  define I2S_CONFIG_RE        (1<<17)
993 #  define I2S_CONFIG_RF        (1<<16)
994 #  define I2S_CONFIG_PD        (1<<11)
995 #  define I2S_CONFIG_LB        (1<<10)
996 #  define I2S_CONFIG_IC        (1<<9)
997 #  define I2S_CONFIG_FM_BIT    7
998 #  define I2S_CONFIG_FM_MASK     (0x3 << I2S_CONFIG_FM_BIT)
999 #    define I2S_CONFIG_FM_I2S    (0x0 << I2S_CONFIG_FM_BIT)
1000 #    define I2S_CONFIG_FM_LJ     (0x1 << I2S_CONFIG_FM_BIT)
1001 #    define I2S_CONFIG_FM_RJ     (0x2 << I2S_CONFIG_FM_BIT)
1002 #  define I2S_CONFIG_TN        (1<<6)
1003 #  define I2S_CONFIG_RN        (1<<5)
1004 #  define I2S_CONFIG_SZ_BIT    0
1005 #  define I2S_CONFIG_SZ_MASK     (0x1F << I2S_CONFIG_SZ_BIT)
1006
1007 #define I2S_CONTROL                0xB1000008
1008 #  define I2S_CONTROL_D         (1<<1)
1009 #  define I2S_CONTROL_CE        (1<<0)
1010
1011 /* USB Host Controller */
1012 #ifndef USB_OHCI_LEN
1013 #define USB_OHCI_LEN              0x00100000
1014 #endif
1015
1016 #ifndef CONFIG_SOC_AU1200
1017
1018 /* USB Device Controller */
1019 #define USBD_EP0RD                0xB0200000
1020 #define USBD_EP0WR                0xB0200004
1021 #define USBD_EP2WR                0xB0200008
1022 #define USBD_EP3WR                0xB020000C
1023 #define USBD_EP4RD                0xB0200010
1024 #define USBD_EP5RD                0xB0200014
1025 #define USBD_INTEN                0xB0200018
1026 #define USBD_INTSTAT              0xB020001C
1027 #  define USBDEV_INT_SOF       (1<<12)
1028 #  define USBDEV_INT_HF_BIT    6
1029 #  define USBDEV_INT_HF_MASK   (0x3f << USBDEV_INT_HF_BIT)
1030 #  define USBDEV_INT_CMPLT_BIT  0
1031 #  define USBDEV_INT_CMPLT_MASK (0x3f << USBDEV_INT_CMPLT_BIT)
1032 #define USBD_CONFIG               0xB0200020
1033 #define USBD_EP0CS                0xB0200024
1034 #define USBD_EP2CS                0xB0200028
1035 #define USBD_EP3CS                0xB020002C
1036 #define USBD_EP4CS                0xB0200030
1037 #define USBD_EP5CS                0xB0200034
1038 #  define USBDEV_CS_SU         (1<<14)
1039 #  define USBDEV_CS_NAK        (1<<13)
1040 #  define USBDEV_CS_ACK        (1<<12)
1041 #  define USBDEV_CS_BUSY       (1<<11)
1042 #  define USBDEV_CS_TSIZE_BIT  1
1043 #  define USBDEV_CS_TSIZE_MASK (0x3ff << USBDEV_CS_TSIZE_BIT)
1044 #  define USBDEV_CS_STALL      (1<<0)
1045 #define USBD_EP0RDSTAT            0xB0200040
1046 #define USBD_EP0WRSTAT            0xB0200044
1047 #define USBD_EP2WRSTAT            0xB0200048
1048 #define USBD_EP3WRSTAT            0xB020004C
1049 #define USBD_EP4RDSTAT            0xB0200050
1050 #define USBD_EP5RDSTAT            0xB0200054
1051 #  define USBDEV_FSTAT_FLUSH     (1<<6)
1052 #  define USBDEV_FSTAT_UF        (1<<5)
1053 #  define USBDEV_FSTAT_OF        (1<<4)
1054 #  define USBDEV_FSTAT_FCNT_BIT  0
1055 #  define USBDEV_FSTAT_FCNT_MASK (0x0f << USBDEV_FSTAT_FCNT_BIT)
1056 #define USBD_ENABLE               0xB0200058
1057 #  define USBDEV_ENABLE (1<<1)
1058 #  define USBDEV_CE     (1<<0)
1059
1060 #endif /* !CONFIG_SOC_AU1200 */
1061
1062 /* Ethernet Controllers  */
1063
1064 /* 4 byte offsets from AU1000_ETH_BASE */
1065 #define MAC_CONTROL                     0x0
1066 #  define MAC_RX_ENABLE               (1<<2)
1067 #  define MAC_TX_ENABLE               (1<<3)
1068 #  define MAC_DEF_CHECK               (1<<5)
1069 #  define MAC_SET_BL(X)       (((X)&0x3)<<6)
1070 #  define MAC_AUTO_PAD                (1<<8)
1071 #  define MAC_DISABLE_RETRY          (1<<10)
1072 #  define MAC_DISABLE_BCAST          (1<<11)
1073 #  define MAC_LATE_COL               (1<<12)
1074 #  define MAC_HASH_MODE              (1<<13)
1075 #  define MAC_HASH_ONLY              (1<<15)
1076 #  define MAC_PASS_ALL               (1<<16)
1077 #  define MAC_INVERSE_FILTER         (1<<17)
1078 #  define MAC_PROMISCUOUS            (1<<18)
1079 #  define MAC_PASS_ALL_MULTI         (1<<19)
1080 #  define MAC_FULL_DUPLEX            (1<<20)
1081 #  define MAC_NORMAL_MODE                 0
1082 #  define MAC_INT_LOOPBACK           (1<<21)
1083 #  define MAC_EXT_LOOPBACK           (1<<22)
1084 #  define MAC_DISABLE_RX_OWN         (1<<23)
1085 #  define MAC_BIG_ENDIAN             (1<<30)
1086 #  define MAC_RX_ALL                 (1<<31)
1087 #define MAC_ADDRESS_HIGH                0x4
1088 #define MAC_ADDRESS_LOW                 0x8
1089 #define MAC_MCAST_HIGH                  0xC
1090 #define MAC_MCAST_LOW                  0x10
1091 #define MAC_MII_CNTRL                  0x14
1092 #  define MAC_MII_BUSY                (1<<0)
1093 #  define MAC_MII_READ                     0
1094 #  define MAC_MII_WRITE               (1<<1)
1095 #  define MAC_SET_MII_SELECT_REG(X)   (((X)&0x1f)<<6)
1096 #  define MAC_SET_MII_SELECT_PHY(X)   (((X)&0x1f)<<11)
1097 #define MAC_MII_DATA                   0x18
1098 #define MAC_FLOW_CNTRL                 0x1C
1099 #  define MAC_FLOW_CNTRL_BUSY         (1<<0)
1100 #  define MAC_FLOW_CNTRL_ENABLE       (1<<1)
1101 #  define MAC_PASS_CONTROL            (1<<2)
1102 #  define MAC_SET_PAUSE(X)        (((X)&0xffff)<<16)
1103 #define MAC_VLAN1_TAG                  0x20
1104 #define MAC_VLAN2_TAG                  0x24
1105
1106 /* Ethernet Controller Enable */
1107
1108 #  define MAC_EN_CLOCK_ENABLE         (1<<0)
1109 #  define MAC_EN_RESET0               (1<<1)
1110 #  define MAC_EN_TOSS                 (0<<2)
1111 #  define MAC_EN_CACHEABLE            (1<<3)
1112 #  define MAC_EN_RESET1               (1<<4)
1113 #  define MAC_EN_RESET2               (1<<5)
1114 #  define MAC_DMA_RESET               (1<<6)
1115
1116 /* Ethernet Controller DMA Channels */
1117
1118 #define MAC0_TX_DMA_ADDR         0xB4004000
1119 #define MAC1_TX_DMA_ADDR         0xB4004200
1120 /* offsets from MAC_TX_RING_ADDR address */
1121 #define MAC_TX_BUFF0_STATUS             0x0
1122 #  define TX_FRAME_ABORTED            (1<<0)
1123 #  define TX_JAB_TIMEOUT              (1<<1)
1124 #  define TX_NO_CARRIER               (1<<2)
1125 #  define TX_LOSS_CARRIER             (1<<3)
1126 #  define TX_EXC_DEF                  (1<<4)
1127 #  define TX_LATE_COLL_ABORT          (1<<5)
1128 #  define TX_EXC_COLL                 (1<<6)
1129 #  define TX_UNDERRUN                 (1<<7)
1130 #  define TX_DEFERRED                 (1<<8)
1131 #  define TX_LATE_COLL                (1<<9)
1132 #  define TX_COLL_CNT_MASK         (0xF<<10)
1133 #  define TX_PKT_RETRY               (1<<31)
1134 #define MAC_TX_BUFF0_ADDR                0x4
1135 #  define TX_DMA_ENABLE               (1<<0)
1136 #  define TX_T_DONE                   (1<<1)
1137 #  define TX_GET_DMA_BUFFER(X)    (((X)>>2)&0x3)
1138 #define MAC_TX_BUFF0_LEN                 0x8
1139 #define MAC_TX_BUFF1_STATUS             0x10
1140 #define MAC_TX_BUFF1_ADDR               0x14
1141 #define MAC_TX_BUFF1_LEN                0x18
1142 #define MAC_TX_BUFF2_STATUS             0x20
1143 #define MAC_TX_BUFF2_ADDR               0x24
1144 #define MAC_TX_BUFF2_LEN                0x28
1145 #define MAC_TX_BUFF3_STATUS             0x30
1146 #define MAC_TX_BUFF3_ADDR               0x34
1147 #define MAC_TX_BUFF3_LEN                0x38
1148
1149 #define MAC0_RX_DMA_ADDR         0xB4004100
1150 #define MAC1_RX_DMA_ADDR         0xB4004300
1151 /* offsets from MAC_RX_RING_ADDR */
1152 #define MAC_RX_BUFF0_STATUS              0x0
1153 #  define RX_FRAME_LEN_MASK           0x3fff
1154 #  define RX_WDOG_TIMER              (1<<14)
1155 #  define RX_RUNT                    (1<<15)
1156 #  define RX_OVERLEN                 (1<<16)
1157 #  define RX_COLL                    (1<<17)
1158 #  define RX_ETHER                   (1<<18)
1159 #  define RX_MII_ERROR               (1<<19)
1160 #  define RX_DRIBBLING               (1<<20)
1161 #  define RX_CRC_ERROR               (1<<21)
1162 #  define RX_VLAN1                   (1<<22)
1163 #  define RX_VLAN2                   (1<<23)
1164 #  define RX_LEN_ERROR               (1<<24)
1165 #  define RX_CNTRL_FRAME             (1<<25)
1166 #  define RX_U_CNTRL_FRAME           (1<<26)
1167 #  define RX_MCAST_FRAME             (1<<27)
1168 #  define RX_BCAST_FRAME             (1<<28)
1169 #  define RX_FILTER_FAIL             (1<<29)
1170 #  define RX_PACKET_FILTER           (1<<30)
1171 #  define RX_MISSED_FRAME            (1<<31)
1172
1173 #  define RX_ERROR (RX_WDOG_TIMER | RX_RUNT | RX_OVERLEN |  \
1174                     RX_COLL | RX_MII_ERROR | RX_CRC_ERROR | \
1175                     RX_LEN_ERROR | RX_U_CNTRL_FRAME | RX_MISSED_FRAME)
1176 #define MAC_RX_BUFF0_ADDR                0x4
1177 #  define RX_DMA_ENABLE               (1<<0)
1178 #  define RX_T_DONE                   (1<<1)
1179 #  define RX_GET_DMA_BUFFER(X)    (((X)>>2)&0x3)
1180 #  define RX_SET_BUFF_ADDR(X)     ((X)&0xffffffc0)
1181 #define MAC_RX_BUFF1_STATUS              0x10
1182 #define MAC_RX_BUFF1_ADDR                0x14
1183 #define MAC_RX_BUFF2_STATUS              0x20
1184 #define MAC_RX_BUFF2_ADDR                0x24
1185 #define MAC_RX_BUFF3_STATUS              0x30
1186 #define MAC_RX_BUFF3_ADDR                0x34
1187
1188
1189 /* UARTS 0-3 */
1190 #define UART_BASE                 UART0_ADDR
1191 #ifdef  CONFIG_SOC_AU1200
1192 #define UART_DEBUG_BASE           UART1_ADDR
1193 #else
1194 #define UART_DEBUG_BASE           UART3_ADDR
1195 #endif
1196
1197 #define UART_RX         0       /* Receive buffer */
1198 #define UART_TX         4       /* Transmit buffer */
1199 #define UART_IER        8       /* Interrupt Enable Register */
1200 #define UART_IIR        0xC     /* Interrupt ID Register */
1201 #define UART_FCR        0x10    /* FIFO Control Register */
1202 #define UART_LCR        0x14    /* Line Control Register */
1203 #define UART_MCR        0x18    /* Modem Control Register */
1204 #define UART_LSR        0x1C    /* Line Status Register */
1205 #define UART_MSR        0x20    /* Modem Status Register */
1206 #define UART_CLK        0x28    /* Baud Rate Clock Divider */
1207 #define UART_MOD_CNTRL  0x100   /* Module Control */
1208
1209 #define UART_FCR_ENABLE_FIFO    0x01 /* Enable the FIFO */
1210 #define UART_FCR_CLEAR_RCVR     0x02 /* Clear the RCVR FIFO */
1211 #define UART_FCR_CLEAR_XMIT     0x04 /* Clear the XMIT FIFO */
1212 #define UART_FCR_DMA_SELECT     0x08 /* For DMA applications */
1213 #define UART_FCR_TRIGGER_MASK   0xF0 /* Mask for the FIFO trigger range */
1214 #define UART_FCR_R_TRIGGER_1    0x00 /* Mask for receive trigger set at 1 */
1215 #define UART_FCR_R_TRIGGER_4    0x40 /* Mask for receive trigger set at 4 */
1216 #define UART_FCR_R_TRIGGER_8    0x80 /* Mask for receive trigger set at 8 */
1217 #define UART_FCR_R_TRIGGER_14   0xA0 /* Mask for receive trigger set at 14 */
1218 #define UART_FCR_T_TRIGGER_0    0x00 /* Mask for transmit trigger set at 0 */
1219 #define UART_FCR_T_TRIGGER_4    0x10 /* Mask for transmit trigger set at 4 */
1220 #define UART_FCR_T_TRIGGER_8    0x20 /* Mask for transmit trigger set at 8 */
1221 #define UART_FCR_T_TRIGGER_12   0x30 /* Mask for transmit trigger set at 12 */
1222
1223 /*
1224  * These are the definitions for the Line Control Register
1225  */
1226 #define UART_LCR_SBC    0x40    /* Set break control */
1227 #define UART_LCR_SPAR   0x20    /* Stick parity (?) */
1228 #define UART_LCR_EPAR   0x10    /* Even parity select */
1229 #define UART_LCR_PARITY 0x08    /* Parity Enable */
1230 #define UART_LCR_STOP   0x04    /* Stop bits: 0=1 stop bit, 1= 2 stop bits */
1231 #define UART_LCR_WLEN5  0x00    /* Wordlength: 5 bits */
1232 #define UART_LCR_WLEN6  0x01    /* Wordlength: 6 bits */
1233 #define UART_LCR_WLEN7  0x02    /* Wordlength: 7 bits */
1234 #define UART_LCR_WLEN8  0x03    /* Wordlength: 8 bits */
1235
1236 /*
1237  * These are the definitions for the Line Status Register
1238  */
1239 #define UART_LSR_TEMT   0x40    /* Transmitter empty */
1240 #define UART_LSR_THRE   0x20    /* Transmit-hold-register empty */
1241 #define UART_LSR_BI     0x10    /* Break interrupt indicator */
1242 #define UART_LSR_FE     0x08    /* Frame error indicator */
1243 #define UART_LSR_PE     0x04    /* Parity error indicator */
1244 #define UART_LSR_OE     0x02    /* Overrun error indicator */
1245 #define UART_LSR_DR     0x01    /* Receiver data ready */
1246
1247 /*
1248  * These are the definitions for the Interrupt Identification Register
1249  */
1250 #define UART_IIR_NO_INT 0x01    /* No interrupts pending */
1251 #define UART_IIR_ID     0x06    /* Mask for the interrupt ID */
1252 #define UART_IIR_MSI    0x00    /* Modem status interrupt */
1253 #define UART_IIR_THRI   0x02    /* Transmitter holding register empty */
1254 #define UART_IIR_RDI    0x04    /* Receiver data interrupt */
1255 #define UART_IIR_RLSI   0x06    /* Receiver line status interrupt */
1256
1257 /*
1258  * These are the definitions for the Interrupt Enable Register
1259  */
1260 #define UART_IER_MSI    0x08    /* Enable Modem status interrupt */
1261 #define UART_IER_RLSI   0x04    /* Enable receiver line status interrupt */
1262 #define UART_IER_THRI   0x02    /* Enable Transmitter holding register int. */
1263 #define UART_IER_RDI    0x01    /* Enable receiver data interrupt */
1264
1265 /*
1266  * These are the definitions for the Modem Control Register
1267  */
1268 #define UART_MCR_LOOP   0x10    /* Enable loopback test mode */
1269 #define UART_MCR_OUT2   0x08    /* Out2 complement */
1270 #define UART_MCR_OUT1   0x04    /* Out1 complement */
1271 #define UART_MCR_RTS    0x02    /* RTS complement */
1272 #define UART_MCR_DTR    0x01    /* DTR complement */
1273
1274 /*
1275  * These are the definitions for the Modem Status Register
1276  */
1277 #define UART_MSR_DCD    0x80    /* Data Carrier Detect */
1278 #define UART_MSR_RI     0x40    /* Ring Indicator */
1279 #define UART_MSR_DSR    0x20    /* Data Set Ready */
1280 #define UART_MSR_CTS    0x10    /* Clear to Send */
1281 #define UART_MSR_DDCD   0x08    /* Delta DCD */
1282 #define UART_MSR_TERI   0x04    /* Trailing edge ring indicator */
1283 #define UART_MSR_DDSR   0x02    /* Delta DSR */
1284 #define UART_MSR_DCTS   0x01    /* Delta CTS */
1285 #define UART_MSR_ANY_DELTA 0x0F /* Any of the delta bits! */
1286
1287
1288
1289 /* SSIO */
1290 #define SSI0_STATUS                0xB1600000
1291 #  define SSI_STATUS_BF              (1<<4)
1292 #  define SSI_STATUS_OF              (1<<3)
1293 #  define SSI_STATUS_UF              (1<<2)
1294 #  define SSI_STATUS_D               (1<<1)
1295 #  define SSI_STATUS_B               (1<<0)
1296 #define SSI0_INT                   0xB1600004
1297 #  define SSI_INT_OI                 (1<<3)
1298 #  define SSI_INT_UI                 (1<<2)
1299 #  define SSI_INT_DI                 (1<<1)
1300 #define SSI0_INT_ENABLE            0xB1600008
1301 #  define SSI_INTE_OIE               (1<<3)
1302 #  define SSI_INTE_UIE               (1<<2)
1303 #  define SSI_INTE_DIE               (1<<1)
1304 #define SSI0_CONFIG                0xB1600020
1305 #  define SSI_CONFIG_AO              (1<<24)
1306 #  define SSI_CONFIG_DO              (1<<23)
1307 #  define SSI_CONFIG_ALEN_BIT        20
1308 #    define SSI_CONFIG_ALEN_MASK       (0x7<<20)
1309 #  define SSI_CONFIG_DLEN_BIT        16
1310 #    define SSI_CONFIG_DLEN_MASK       (0x7<<16)
1311 #  define SSI_CONFIG_DD              (1<<11)
1312 #  define SSI_CONFIG_AD              (1<<10)
1313 #  define SSI_CONFIG_BM_BIT          8
1314 #    define SSI_CONFIG_BM_MASK         (0x3<<8)
1315 #  define SSI_CONFIG_CE              (1<<7)
1316 #  define SSI_CONFIG_DP              (1<<6)
1317 #  define SSI_CONFIG_DL              (1<<5)
1318 #  define SSI_CONFIG_EP              (1<<4)
1319 #define SSI0_ADATA                 0xB1600024
1320 #  define SSI_AD_D                   (1<<24)
1321 #  define SSI_AD_ADDR_BIT            16
1322 #    define SSI_AD_ADDR_MASK           (0xff<<16)
1323 #  define SSI_AD_DATA_BIT            0
1324 #    define SSI_AD_DATA_MASK           (0xfff<<0)
1325 #define SSI0_CLKDIV                0xB1600028
1326 #define SSI0_CONTROL               0xB1600100
1327 #  define SSI_CONTROL_CD             (1<<1)
1328 #  define SSI_CONTROL_E              (1<<0)
1329
1330 /* SSI1 */
1331 #define SSI1_STATUS                0xB1680000
1332 #define SSI1_INT                   0xB1680004
1333 #define SSI1_INT_ENABLE            0xB1680008
1334 #define SSI1_CONFIG                0xB1680020
1335 #define SSI1_ADATA                 0xB1680024
1336 #define SSI1_CLKDIV                0xB1680028
1337 #define SSI1_ENABLE                0xB1680100
1338
1339 /*
1340  * Register content definitions
1341  */
1342 #define SSI_STATUS_BF                           (1<<4)
1343 #define SSI_STATUS_OF                           (1<<3)
1344 #define SSI_STATUS_UF                           (1<<2)
1345 #define SSI_STATUS_D                            (1<<1)
1346 #define SSI_STATUS_B                            (1<<0)
1347
1348 /* SSI_INT */
1349 #define SSI_INT_OI                                      (1<<3)
1350 #define SSI_INT_UI                                      (1<<2)
1351 #define SSI_INT_DI                                      (1<<1)
1352
1353 /* SSI_INTEN */
1354 #define SSI_INTEN_OIE                           (1<<3)
1355 #define SSI_INTEN_UIE                           (1<<2)
1356 #define SSI_INTEN_DIE                           (1<<1)
1357
1358 #define SSI_CONFIG_AO                           (1<<24)
1359 #define SSI_CONFIG_DO                           (1<<23)
1360 #define SSI_CONFIG_ALEN                         (7<<20)
1361 #define SSI_CONFIG_DLEN                         (15<<16)
1362 #define SSI_CONFIG_DD                           (1<<11)
1363 #define SSI_CONFIG_AD                           (1<<10)
1364 #define SSI_CONFIG_BM                           (3<<8)
1365 #define SSI_CONFIG_CE                           (1<<7)
1366 #define SSI_CONFIG_DP                           (1<<6)
1367 #define SSI_CONFIG_DL                           (1<<5)
1368 #define SSI_CONFIG_EP                           (1<<4)
1369 #define SSI_CONFIG_ALEN_N(N)            ((N-1)<<20)
1370 #define SSI_CONFIG_DLEN_N(N)            ((N-1)<<16)
1371 #define SSI_CONFIG_BM_HI                        (0<<8)
1372 #define SSI_CONFIG_BM_LO                        (1<<8)
1373 #define SSI_CONFIG_BM_CY                        (2<<8)
1374
1375 #define SSI_ADATA_D                                     (1<<24)
1376 #define SSI_ADATA_ADDR                          (0xFF<<16)
1377 #define SSI_ADATA_DATA                          (0x0FFF)
1378 #define SSI_ADATA_ADDR_N(N)                     (N<<16)
1379
1380 #define SSI_ENABLE_CD                           (1<<1)
1381 #define SSI_ENABLE_E                            (1<<0)
1382
1383
1384 /* IrDA Controller */
1385 #define IRDA_BASE                 0xB0300000
1386 #define IR_RING_PTR_STATUS        (IRDA_BASE+0x00)
1387 #define IR_RING_BASE_ADDR_H       (IRDA_BASE+0x04)
1388 #define IR_RING_BASE_ADDR_L       (IRDA_BASE+0x08)
1389 #define IR_RING_SIZE              (IRDA_BASE+0x0C)
1390 #define IR_RING_PROMPT            (IRDA_BASE+0x10)
1391 #define IR_RING_ADDR_CMPR         (IRDA_BASE+0x14)
1392 #define IR_INT_CLEAR              (IRDA_BASE+0x18)
1393 #define IR_CONFIG_1               (IRDA_BASE+0x20)
1394 #  define IR_RX_INVERT_LED        (1<<0)
1395 #  define IR_TX_INVERT_LED        (1<<1)
1396 #  define IR_ST                   (1<<2)
1397 #  define IR_SF                   (1<<3)
1398 #  define IR_SIR                  (1<<4)
1399 #  define IR_MIR                  (1<<5)
1400 #  define IR_FIR                  (1<<6)
1401 #  define IR_16CRC                (1<<7)
1402 #  define IR_TD                   (1<<8)
1403 #  define IR_RX_ALL               (1<<9)
1404 #  define IR_DMA_ENABLE           (1<<10)
1405 #  define IR_RX_ENABLE            (1<<11)
1406 #  define IR_TX_ENABLE            (1<<12)
1407 #  define IR_LOOPBACK             (1<<14)
1408 #  define IR_SIR_MODE             (IR_SIR | IR_DMA_ENABLE | \
1409                                    IR_RX_ALL | IR_RX_ENABLE | IR_SF | IR_16CRC)
1410 #define IR_SIR_FLAGS              (IRDA_BASE+0x24)
1411 #define IR_ENABLE                 (IRDA_BASE+0x28)
1412 #  define IR_RX_STATUS            (1<<9)
1413 #  define IR_TX_STATUS            (1<<10)
1414 #define IR_READ_PHY_CONFIG        (IRDA_BASE+0x2C)
1415 #define IR_WRITE_PHY_CONFIG       (IRDA_BASE+0x30)
1416 #define IR_MAX_PKT_LEN            (IRDA_BASE+0x34)
1417 #define IR_RX_BYTE_CNT            (IRDA_BASE+0x38)
1418 #define IR_CONFIG_2               (IRDA_BASE+0x3C)
1419 #  define IR_MODE_INV             (1<<0)
1420 #  define IR_ONE_PIN              (1<<1)
1421 #define IR_INTERFACE_CONFIG       (IRDA_BASE+0x40)
1422
1423 /* GPIO */
1424 #define SYS_PINFUNC               0xB190002C
1425 #  define SYS_PF_USB                    (1<<15) /* 2nd USB device/host */
1426 #  define SYS_PF_U3                     (1<<14) /* GPIO23/U3TXD */
1427 #  define SYS_PF_U2                     (1<<13) /* GPIO22/U2TXD */
1428 #  define SYS_PF_U1                     (1<<12) /* GPIO21/U1TXD */
1429 #  define SYS_PF_SRC                    (1<<11) /* GPIO6/SROMCKE */
1430 #  define SYS_PF_CK5                    (1<<10) /* GPIO3/CLK5 */
1431 #  define SYS_PF_CK4                    (1<<9)  /* GPIO2/CLK4 */
1432 #  define SYS_PF_IRF                    (1<<8)  /* GPIO15/IRFIRSEL */
1433 #  define SYS_PF_UR3                    (1<<7)  /* GPIO[14:9]/UART3 */
1434 #  define SYS_PF_I2D                    (1<<6)  /* GPIO8/I2SDI */
1435 #  define SYS_PF_I2S                    (1<<5)  /* I2S/GPIO[29:31] */
1436 #  define SYS_PF_NI2                    (1<<4)  /* NI2/GPIO[24:28] */
1437 #  define SYS_PF_U0                     (1<<3)  /* U0TXD/GPIO20 */
1438 #  define SYS_PF_RD                     (1<<2)  /* IRTXD/GPIO19 */
1439 #  define SYS_PF_A97                    (1<<1)  /* AC97/SSL1 */
1440 #  define SYS_PF_S0                     (1<<0)  /* SSI_0/GPIO[16:18] */
1441
1442 /* Au1100 Only */
1443 #  define SYS_PF_PC                     (1<<18) /* PCMCIA/GPIO[207:204] */
1444 #  define SYS_PF_LCD                    (1<<17) /* extern lcd/GPIO[203:200] */
1445 #  define SYS_PF_CS                     (1<<16) /* EXTCLK0/32khz to gpio2 */
1446 #  define SYS_PF_EX0                    (1<<9)  /* gpio2/clock */
1447
1448 /* Au1550 Only.  Redefines lots of pins */
1449 #  define SYS_PF_PSC2_MASK              (7 << 17)
1450 #  define SYS_PF_PSC2_AC97              (0)
1451 #  define SYS_PF_PSC2_SPI               (0)
1452 #  define SYS_PF_PSC2_I2S               (1 << 17)
1453 #  define SYS_PF_PSC2_SMBUS             (3 << 17)
1454 #  define SYS_PF_PSC2_GPIO              (7 << 17)
1455 #  define SYS_PF_PSC3_MASK              (7 << 20)
1456 #  define SYS_PF_PSC3_AC97              (0)
1457 #  define SYS_PF_PSC3_SPI               (0)
1458 #  define SYS_PF_PSC3_I2S               (1 << 20)
1459 #  define SYS_PF_PSC3_SMBUS             (3 << 20)
1460 #  define SYS_PF_PSC3_GPIO              (7 << 20)
1461 #  define SYS_PF_PSC1_S1                (1 << 1)
1462 #  define SYS_PF_MUST_BE_SET            ((1 << 5) | (1 << 2))
1463
1464 /* Au1200 Only */
1465 #ifdef CONFIG_SOC_AU1200
1466 #define SYS_PINFUNC_DMA         (1<<31)
1467 #define SYS_PINFUNC_S0A         (1<<30)
1468 #define SYS_PINFUNC_S1A         (1<<29)
1469 #define SYS_PINFUNC_LP0         (1<<28)
1470 #define SYS_PINFUNC_LP1         (1<<27)
1471 #define SYS_PINFUNC_LD16        (1<<26)
1472 #define SYS_PINFUNC_LD8         (1<<25)
1473 #define SYS_PINFUNC_LD1         (1<<24)
1474 #define SYS_PINFUNC_LD0         (1<<23)
1475 #define SYS_PINFUNC_P1A         (3<<21)
1476 #define SYS_PINFUNC_P1B         (1<<20)
1477 #define SYS_PINFUNC_FS3         (1<<19)
1478 #define SYS_PINFUNC_P0A         (3<<17)
1479 #define SYS_PINFUNC_CS          (1<<16)
1480 #define SYS_PINFUNC_CIM         (1<<15)
1481 #define SYS_PINFUNC_P1C         (1<<14)
1482 #define SYS_PINFUNC_U1T         (1<<12)
1483 #define SYS_PINFUNC_U1R         (1<<11)
1484 #define SYS_PINFUNC_EX1         (1<<10)
1485 #define SYS_PINFUNC_EX0         (1<<9)
1486 #define SYS_PINFUNC_U0R         (1<<8)
1487 #define SYS_PINFUNC_MC          (1<<7)
1488 #define SYS_PINFUNC_S0B         (1<<6)
1489 #define SYS_PINFUNC_S0C         (1<<5)
1490 #define SYS_PINFUNC_P0B         (1<<4)
1491 #define SYS_PINFUNC_U0T         (1<<3)
1492 #define SYS_PINFUNC_S1B         (1<<2)
1493 #endif
1494
1495 #define SYS_TRIOUTRD              0xB1900100
1496 #define SYS_TRIOUTCLR             0xB1900100
1497 #define SYS_OUTPUTRD              0xB1900108
1498 #define SYS_OUTPUTSET             0xB1900108
1499 #define SYS_OUTPUTCLR             0xB190010C
1500 #define SYS_PINSTATERD            0xB1900110
1501 #define SYS_PININPUTEN            0xB1900110
1502
1503 /* GPIO2, Au1500, Au1550 only */
1504 #define GPIO2_BASE                0xB1700000
1505 #define GPIO2_DIR                 (GPIO2_BASE + 0)
1506 #define GPIO2_OUTPUT              (GPIO2_BASE + 8)
1507 #define GPIO2_PINSTATE            (GPIO2_BASE + 0xC)
1508 #define GPIO2_INTENABLE           (GPIO2_BASE + 0x10)
1509 #define GPIO2_ENABLE              (GPIO2_BASE + 0x14)
1510
1511 /* Power Management */
1512 #define SYS_SCRATCH0              0xB1900018
1513 #define SYS_SCRATCH1              0xB190001C
1514 #define SYS_WAKEMSK               0xB1900034
1515 #define SYS_ENDIAN                0xB1900038
1516 #define SYS_POWERCTRL             0xB190003C
1517 #define SYS_WAKESRC               0xB190005C
1518 #define SYS_SLPPWR                0xB1900078
1519 #define SYS_SLEEP                 0xB190007C
1520
1521 /* Clock Controller */
1522 #define SYS_FREQCTRL0             0xB1900020
1523 #  define SYS_FC_FRDIV2_BIT         22
1524 #  define SYS_FC_FRDIV2_MASK        (0xff << SYS_FC_FRDIV2_BIT)
1525 #  define SYS_FC_FE2                (1<<21)
1526 #  define SYS_FC_FS2                (1<<20)
1527 #  define SYS_FC_FRDIV1_BIT         12
1528 #  define SYS_FC_FRDIV1_MASK        (0xff << SYS_FC_FRDIV1_BIT)
1529 #  define SYS_FC_FE1                (1<<11)
1530 #  define SYS_FC_FS1                (1<<10)
1531 #  define SYS_FC_FRDIV0_BIT         2
1532 #  define SYS_FC_FRDIV0_MASK        (0xff << SYS_FC_FRDIV0_BIT)
1533 #  define SYS_FC_FE0                (1<<1)
1534 #  define SYS_FC_FS0                (1<<0)
1535 #define SYS_FREQCTRL1             0xB1900024
1536 #  define SYS_FC_FRDIV5_BIT         22
1537 #  define SYS_FC_FRDIV5_MASK        (0xff << SYS_FC_FRDIV5_BIT)
1538 #  define SYS_FC_FE5                (1<<21)
1539 #  define SYS_FC_FS5                (1<<20)
1540 #  define SYS_FC_FRDIV4_BIT         12
1541 #  define SYS_FC_FRDIV4_MASK        (0xff << SYS_FC_FRDIV4_BIT)
1542 #  define SYS_FC_FE4                (1<<11)
1543 #  define SYS_FC_FS4                (1<<10)
1544 #  define SYS_FC_FRDIV3_BIT         2
1545 #  define SYS_FC_FRDIV3_MASK        (0xff << SYS_FC_FRDIV3_BIT)
1546 #  define SYS_FC_FE3                (1<<1)
1547 #  define SYS_FC_FS3                (1<<0)
1548 #define SYS_CLKSRC                0xB1900028
1549 #  define SYS_CS_ME1_BIT            27
1550 #  define SYS_CS_ME1_MASK           (0x7<<SYS_CS_ME1_BIT)
1551 #  define SYS_CS_DE1                (1<<26)
1552 #  define SYS_CS_CE1                (1<<25)
1553 #  define SYS_CS_ME0_BIT            22
1554 #  define SYS_CS_ME0_MASK           (0x7<<SYS_CS_ME0_BIT)
1555 #  define SYS_CS_DE0                (1<<21)
1556 #  define SYS_CS_CE0                (1<<20)
1557 #  define SYS_CS_MI2_BIT            17
1558 #  define SYS_CS_MI2_MASK           (0x7<<SYS_CS_MI2_BIT)
1559 #  define SYS_CS_DI2                (1<<16)
1560 #  define SYS_CS_CI2                (1<<15)
1561 #ifdef CONFIG_SOC_AU1100
1562 #  define SYS_CS_ML_BIT             7
1563 #  define SYS_CS_ML_MASK            (0x7<<SYS_CS_ML_BIT)
1564 #  define SYS_CS_DL                 (1<<6)
1565 #  define SYS_CS_CL                 (1<<5)
1566 #else
1567 #  define SYS_CS_MUH_BIT            12
1568 #  define SYS_CS_MUH_MASK           (0x7<<SYS_CS_MUH_BIT)
1569 #  define SYS_CS_DUH                (1<<11)
1570 #  define SYS_CS_CUH                (1<<10)
1571 #  define SYS_CS_MUD_BIT            7
1572 #  define SYS_CS_MUD_MASK           (0x7<<SYS_CS_MUD_BIT)
1573 #  define SYS_CS_DUD                (1<<6)
1574 #  define SYS_CS_CUD                (1<<5)
1575 #endif
1576 #  define SYS_CS_MIR_BIT            2
1577 #  define SYS_CS_MIR_MASK           (0x7<<SYS_CS_MIR_BIT)
1578 #  define SYS_CS_DIR                (1<<1)
1579 #  define SYS_CS_CIR                (1<<0)
1580
1581 #  define SYS_CS_MUX_AUX            0x1
1582 #  define SYS_CS_MUX_FQ0            0x2
1583 #  define SYS_CS_MUX_FQ1            0x3
1584 #  define SYS_CS_MUX_FQ2            0x4
1585 #  define SYS_CS_MUX_FQ3            0x5
1586 #  define SYS_CS_MUX_FQ4            0x6
1587 #  define SYS_CS_MUX_FQ5            0x7
1588 #define SYS_CPUPLL                0xB1900060
1589 #define SYS_AUXPLL                0xB1900064
1590
1591 /* AC97 Controller */
1592 #define AC97C_CONFIG              0xB0000000
1593 #  define AC97C_RECV_SLOTS_BIT  13
1594 #  define AC97C_RECV_SLOTS_MASK (0x3ff << AC97C_RECV_SLOTS_BIT)
1595 #  define AC97C_XMIT_SLOTS_BIT  3
1596 #  define AC97C_XMIT_SLOTS_MASK (0x3ff << AC97C_XMIT_SLOTS_BIT)
1597 #  define AC97C_SG              (1<<2)
1598 #  define AC97C_SYNC            (1<<1)
1599 #  define AC97C_RESET           (1<<0)
1600 #define AC97C_STATUS              0xB0000004
1601 #  define AC97C_XU              (1<<11)
1602 #  define AC97C_XO              (1<<10)
1603 #  define AC97C_RU              (1<<9)
1604 #  define AC97C_RO              (1<<8)
1605 #  define AC97C_READY           (1<<7)
1606 #  define AC97C_CP              (1<<6)
1607 #  define AC97C_TR              (1<<5)
1608 #  define AC97C_TE              (1<<4)
1609 #  define AC97C_TF              (1<<3)
1610 #  define AC97C_RR              (1<<2)
1611 #  define AC97C_RE              (1<<1)
1612 #  define AC97C_RF              (1<<0)
1613 #define AC97C_DATA                0xB0000008
1614 #define AC97C_CMD                 0xB000000C
1615 #  define AC97C_WD_BIT          16
1616 #  define AC97C_READ            (1<<7)
1617 #  define AC97C_INDEX_MASK      0x7f
1618 #define AC97C_CNTRL               0xB0000010
1619 #  define AC97C_RS              (1<<1)
1620 #  define AC97C_CE              (1<<0)
1621
1622
1623 /* Secure Digital (SD) Controller */
1624 #define SD0_XMIT_FIFO   0xB0600000
1625 #define SD0_RECV_FIFO   0xB0600004
1626 #define SD1_XMIT_FIFO   0xB0680000
1627 #define SD1_RECV_FIFO   0xB0680004
1628
1629 #if defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550)
1630 /* Au1500 PCI Controller */
1631 #define Au1500_CFG_BASE           0xB4005000 // virtual, kseg0 addr
1632 #define Au1500_PCI_CMEM           (Au1500_CFG_BASE + 0)
1633 #define Au1500_PCI_CFG            (Au1500_CFG_BASE + 4)
1634 #  define PCI_ERROR ((1<<22) | (1<<23) | (1<<24) | (1<<25) | (1<<26) | (1<<27))
1635 #define Au1500_PCI_B2BMASK_CCH    (Au1500_CFG_BASE + 8)
1636 #define Au1500_PCI_B2B0_VID       (Au1500_CFG_BASE + 0xC)
1637 #define Au1500_PCI_B2B1_ID        (Au1500_CFG_BASE + 0x10)
1638 #define Au1500_PCI_MWMASK_DEV     (Au1500_CFG_BASE + 0x14)
1639 #define Au1500_PCI_MWBASE_REV_CCL (Au1500_CFG_BASE + 0x18)
1640 #define Au1500_PCI_ERR_ADDR       (Au1500_CFG_BASE + 0x1C)
1641 #define Au1500_PCI_SPEC_INTACK    (Au1500_CFG_BASE + 0x20)
1642 #define Au1500_PCI_ID             (Au1500_CFG_BASE + 0x100)
1643 #define Au1500_PCI_STATCMD        (Au1500_CFG_BASE + 0x104)
1644 #define Au1500_PCI_CLASSREV       (Au1500_CFG_BASE + 0x108)
1645 #define Au1500_PCI_HDRTYPE        (Au1500_CFG_BASE + 0x10C)
1646 #define Au1500_PCI_MBAR           (Au1500_CFG_BASE + 0x110)
1647
1648 #define Au1500_PCI_HDR            0xB4005100 // virtual, kseg0 addr
1649
1650 /* All of our structures, like pci resource, have 32 bit members.
1651  * Drivers are expected to do an ioremap on the PCI MEM resource, but it's
1652  * hard to store 0x4 0000 0000 in a 32 bit type.  We require a small patch
1653  * to __ioremap to check for addresses between (u32)Au1500_PCI_MEM_START and
1654  * (u32)Au1500_PCI_MEM_END and change those to the full 36 bit PCI MEM
1655  * addresses.  For PCI IO, it's simpler because we get to do the ioremap
1656  * ourselves and then adjust the device's resources.
1657  */
1658 #define Au1500_EXT_CFG            0x600000000ULL
1659 #define Au1500_EXT_CFG_TYPE1      0x680000000ULL
1660 #define Au1500_PCI_IO_START       0x500000000ULL
1661 #define Au1500_PCI_IO_END         0x5000FFFFFULL
1662 #define Au1500_PCI_MEM_START      0x440000000ULL
1663 #define Au1500_PCI_MEM_END        0x44FFFFFFFULL
1664
1665 #define PCI_IO_START    (Au1500_PCI_IO_START + 0x1000)
1666 #define PCI_IO_END      (Au1500_PCI_IO_END)
1667 #define PCI_MEM_START   (Au1500_PCI_MEM_START)
1668 #define PCI_MEM_END     (Au1500_PCI_MEM_END)
1669 #define PCI_FIRST_DEVFN (0<<3)
1670 #define PCI_LAST_DEVFN  (19<<3)
1671
1672 #define IOPORT_RESOURCE_START 0x00001000 /* skip legacy probing */
1673 #define IOPORT_RESOURCE_END   0xffffffff
1674 #define IOMEM_RESOURCE_START  0x10000000
1675 #define IOMEM_RESOURCE_END    0xffffffff
1676
1677   /*
1678    * Borrowed from the PPC arch:
1679    * The following macro is used to lookup irqs in a standard table
1680    * format for those PPC systems that do not already have PCI
1681    * interrupts properly routed.
1682    */
1683   /* FIXME - double check this from asm-ppc/pci-bridge.h */
1684 #define PCI_IRQ_TABLE_LOOKUP                            \
1685   ({ long _ctl_ = -1;                                 \
1686       if (idsel >= min_idsel && idsel <= max_idsel && pin <= irqs_per_slot)    \
1687                _ctl_ = pci_irq_table[idsel - min_idsel][pin-1];               \
1688                       _ctl_; })
1689
1690
1691 #else /* Au1000 and Au1100 and Au1200 */
1692
1693 /* don't allow any legacy ports probing */
1694 #define IOPORT_RESOURCE_START 0x10000000
1695 #define IOPORT_RESOURCE_END   0xffffffff
1696 #define IOMEM_RESOURCE_START  0x10000000
1697 #define IOMEM_RESOURCE_END    0xffffffff
1698
1699 #define PCI_IO_START    0
1700 #define PCI_IO_END      0
1701 #define PCI_MEM_START   0
1702 #define PCI_MEM_END     0
1703 #define PCI_FIRST_DEVFN 0
1704 #define PCI_LAST_DEVFN  0
1705
1706 #endif
1707
1708 #ifndef _LANGUAGE_ASSEMBLY
1709 typedef volatile struct
1710 {
1711         /* 0x0000 */ u32 toytrim;
1712         /* 0x0004 */ u32 toywrite;
1713         /* 0x0008 */ u32 toymatch0;
1714         /* 0x000C */ u32 toymatch1;
1715         /* 0x0010 */ u32 toymatch2;
1716         /* 0x0014 */ u32 cntrctrl;
1717         /* 0x0018 */ u32 scratch0;
1718         /* 0x001C */ u32 scratch1;
1719         /* 0x0020 */ u32 freqctrl0;
1720         /* 0x0024 */ u32 freqctrl1;
1721         /* 0x0028 */ u32 clksrc;
1722         /* 0x002C */ u32 pinfunc;
1723         /* 0x0030 */ u32 reserved0;
1724         /* 0x0034 */ u32 wakemsk;
1725         /* 0x0038 */ u32 endian;
1726         /* 0x003C */ u32 powerctrl;
1727         /* 0x0040 */ u32 toyread;
1728         /* 0x0044 */ u32 rtctrim;
1729         /* 0x0048 */ u32 rtcwrite;
1730         /* 0x004C */ u32 rtcmatch0;
1731         /* 0x0050 */ u32 rtcmatch1;
1732         /* 0x0054 */ u32 rtcmatch2;
1733         /* 0x0058 */ u32 rtcread;
1734         /* 0x005C */ u32 wakesrc;
1735         /* 0x0060 */ u32 cpupll;
1736         /* 0x0064 */ u32 auxpll;
1737         /* 0x0068 */ u32 reserved1;
1738         /* 0x006C */ u32 reserved2;
1739         /* 0x0070 */ u32 reserved3;
1740         /* 0x0074 */ u32 reserved4;
1741         /* 0x0078 */ u32 slppwr;
1742         /* 0x007C */ u32 sleep;
1743         /* 0x0080 */ u32 reserved5[32];
1744         /* 0x0100 */ u32 trioutrd;
1745 #define trioutclr trioutrd
1746         /* 0x0104 */ u32 reserved6;
1747         /* 0x0108 */ u32 outputrd;
1748 #define outputset outputrd
1749         /* 0x010C */ u32 outputclr;
1750         /* 0x0110 */ u32 pinstaterd;
1751 #define pininputen pinstaterd
1752
1753 } AU1X00_SYS;
1754
1755 static AU1X00_SYS* const sys  = (AU1X00_SYS *)SYS_BASE;
1756
1757 #endif
1758 /* Processor information base on prid.
1759  * Copied from PowerPC.
1760  */
1761 #ifndef _LANGUAGE_ASSEMBLY
1762 struct cpu_spec {
1763         /* CPU is matched via (PRID & prid_mask) == prid_value */
1764         unsigned int    prid_mask;
1765         unsigned int    prid_value;
1766
1767         char            *cpu_name;
1768         unsigned char   cpu_od;         /* Set Config[OD] */
1769         unsigned char   cpu_bclk;       /* Enable BCLK switching */
1770 };
1771
1772 extern struct cpu_spec          cpu_specs[];
1773 extern struct cpu_spec          *cur_cpu_spec[];
1774 #endif
1775
1776 #endif
1777